I draw kind of signal lines on charts using loop with Plot and Line Array. It looks like this:
for ( i = 5; i < BarCount; i++ )
{
x0Buy=i-1;
x1Buy=i;
y0Buy=H[i-1];
y1Buy=y0Buy;
showBuy=IIf(H[i-1]<H[i-2] AND L[i-1]>L[i-2],1,0 )
Plot(IIf(showBuy==1,LineArray(x0Buy,y0Buy,x1Buy,y1Buy),Null),"",colorYellow,styleThick);
}
I know that Plot inside for-loop is not optimal, that is why I would like to work on arrays. I'm trying to use code like this below, however I've got problems with defining X co-ordinates:
x0Buy=???; //(previous bar);
x1Buy=???; //(current bar);
y0Buy=H[i-1]; //(y value for previous bar)
y1Buy=y0Buy; //(y value for current bar)
showBuy=IIf( Ref(H,-1)<Ref(H,-2) AND Ref(L-1)>Ref(L,-2),1,0 )
Plot(IIf(showBuy==1,LineArray(???x0Buy???, y0Buy, ???x1Buy???, y1Buy), Null),"",colorYellow,styleThick);
I would like to draw LinaArray not only on the last bar, but on the whole chart. I think I should define somehow X position of the bar for LineArray purposes. I did (almost) the same with PlotShapes on arrays (because it doesn't need to define X coordinates, it is enough when showBuy==1), but LineArray is visually much better that is why I would like to solve this issue.
Any suggerstions, please?