I'm coding custom back testing procedure where I want to calculate position size based on some data array. Say, I've got "precooked" MyDataArray[] (just for example here it's LLV of lows) and want to use it. What I'm observing inside of Phase2 loop it all the time returns me a 0 value for any element of MyDataArray. Is that normal? I may do not well understand internals of AFL run-time but this seems to be a simple thing that I'm trying to solve for the whole couple hours . Simple snippet below will show what I mean. It's really looks strange that I can't use previously created data array.
Even more interesting, run-time goes through code twice (see _TRACE output) and on the second run MeDataArray is zeroed. Why? Anybody can help with this issue or point me out where I'm going wrong way?
TIA
Even more interesting, run-time goes through code twice (see _TRACE output) and on the second run MeDataArray is zeroed. Why? Anybody can help with this issue or point me out where I'm going wrong way?
Code:
MyDataArray=LLV(L,5);
_TRACE("*** (1) MyDataArray: "+MyDataArray[0]);
Buy=1;
Sell=1;
Short=1;
Cover=1;
SetOption("UseCustomBacktestProc",True);
_TRACE("*** (2) ***");
if(Status("action")==actionPortfolio)
{
bo = GetBacktesterObject();
bo.PreProcess();
for (bar = 0; bar < BarCount; bar++)
{
_TRACE("MyDataArray["+bar+"]: "+MyDataArray[bar]);
}
bo.PostProcess();
}
_TRACE("*** (3) ***");
TIA