I have an issue which I don't quite know where to start... I created an AFL which I plot in a pane. The result is perfect: the buy/sell signals are plotted on the exact day. In a "visual" way, everything is ok.
Now I wanted to SCAN the chart for these signals. I set the correct intraday-periodicity (e.g. 15min) and click SCAN - no results the "mathematical" way.
The confusing thing is that on a daily basis (daily database), it seems to be working perfect, on an intraday basis (separate database), it does not work as desired.
I wonder if you can tell me if the structure of my AFL contains any logical mistakes or not. I cannot copy/paste the whole AFL, that would be several hundred lines of IP, so I SHORTENED it a lot:
// ==============================================
// a VERY simplified version of my AFL structure
// do not question the rules or logic in this AFL (they make no sense), it's only for DEMONSTRATION purpose of the STRUCTURE.
for (v1 = 1; v1 < BarCount; v1++)
{
for (v2 = 1; v2 < BarCount; v2++)
{
if (C[v2] > 2) //
{
x0 = rule1[v1];
y0 = rule2[v1];
x1 = rule1[v2];
y1 = rule2[v2];
newTL = LineArray(x0,y0,x1,y1,0,0);
if (bi[v2] > 500))
{
Plot(newTL,"",colorRed, styleNoLabel);
Buy[v2] = C[v2]; // Point1: arguments are passed successfully through the loops and a BUY is generated
for(s=(v2+1); s < BarCount; s++)
{
Sell[s] = C[s];
Sell = ExRem( sell, buy );
break;
}
}
break;
}
}
}
// BUY from Point1 is successfully plotted
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen,layer=0, yposition=Graph0, -20);
PlotShapes(IIf(Sell, shapedownArrow, shapeNone),colorRed,layer=0, yposition=Graph0, -20);
Considering that the values are passed through the loops in a correct way and a BUY is generated and used for plotting, I would assume that they are calculated during the SCAN in the same way?
any help, indication, tip or whatsoever would be much appreciated! Thank you