Can I plot buy and sell symbol in my strategy?. If yes then please write the script

In my strategy when a buy or sell signal generates the symbol does not occur but it shows me in alert …is there any method or code which shows me buy and sell symbols in chart

1 Like

Yes, you can plot buy and symbols according to your condition and strategy .

the example code based on heikin-ashi is below

Buy:

SET HC = (OPEN+HIGH+LOW+CLOSE)/4
SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2
SET HH = MAXOF(HIGH, MAXOF(HC, HO))
SET HW = MINOF(LOW, HO, HC)
HC>MAXOF(REF(HH,1),REF(HH,2),REF(HH,3), REF(HH,4))

  Sell:

SET HC = (OPEN+HIGH+LOW+CLOSE)/4
SET HO = (REF(OPEN,1) + REF(CLOSE,1))/2
SET HH = MAXOF(HIGH, MAXOF(HC, HO))
SET HW = MINOF(LOW, HO, HC)
HC<MAXOF(REF(HH,1),REF(HH,2),REF(HH,3), REF(HH,4)) 

Heres a simple code

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorBlack,0,Low,Offset=-15);

The last numerical value lets you change the position of the arrow.

The below given code does not work as the AFL code.

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorBlack,0,Low,Offset=-15);

Can anybody help to provide the script code for plotting buy/sell signal symbol which can be plotted to any of the created Expert Advisors in Pi charting/trading platform.