Unable to plot shape

Unable to plot shapes on OHLC charts, code when applied shows no error

_SECTION_BEGIN("Strength");
Strength = ((abs(O-C)/H-L)*100);
Buy=Strength>=50;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, 0, 5, 0);
_SECTION_END();

Any help appreciated
regards
Sreenivasa

Hello sreeni08,

  1. Strength will never reach ">= 50", check mathematics
Strength = ( ( abs( O - C ) / H - L ) * 100 );

result in:

image

  1. Change mathematics
Strength = ( ( abs( O - C ) / ( H - L ) ) * 100 );

image

  1. To plot shapes you have to define yposition correct, you plot at zero line position just in time
PlotShapes( IIf( Buy, shapeSmallSquare, shapeNone ), colorBrightGreen, 0, L, -12, 0 );

image

regards, Peter

3 Likes

Thanks Peter for the help
rather than this "Strength = ((abs(O-C))/(H-L)*100);"
I was using this " Strength = ((abs(O-C)/H-L)*100);

thanks again
Sreenivasa