i have an array of my net position size, ie it is not the raw trading signals 
any more. It is e.g {6,6,6,-3,-3,-3,10,10,10.....} So at some point you will 
need to sell 6 contracts to clear the long, short 3, then later cover 3 and buy 
10. 

Can this be done without the custom backtester and can anybody point me in the 
right direction. I am new to afl and this was how i started but then just 
stopped when i couldnt get it. I know its full of errors but just for 
background :

//Set Backtestmode
SetBacktestMode(backtestregularrawmulti);


// delays
SetTradeDelays( 0, 0, 0, 0 );
BuyPrice = SellPrice = Open; 


SetPositionSize(abs(xxxtotal-Ref(xxxtotal,-1)),spsShares);


for( i = 1; i < BarCount; i++ ){
        Buy[i]=0;
        Sell[i]=0;
        Short[i]=0;
        Cover[i]=0;
        aaa[i]=xxxtotal[i];
        bbb[i] = PositionSize[i];
        if (xxxtotal[i-1]>0){
                if (xxxtotal[i]<0){
//how do i get positionsizes right here?
                        Sell[i] = 1;
                        Short[i] = 1;
                }
                else if (xxxtotal[i]>xxxtotal[i-1]){
                        Buy[i] = sigScaleIn;
                }
                else if (xxxtotal[i]<0){
                        Sell[i] = sigScaleOut;

                }
                else if (xxxtotal[i]<xxxtotal[i-1]){
                        Sell[i] = sigScaleOut;
                }
        }
        else if (xxxtotal[i-1]<0){
                if (xxxtotal[i-1]>0){
                        Cover[i] = 1;
//and again the positionsizes?
                        Buy[i] = sigScaleIn;
                }
                else if (xxxtotal[i]<xxxtotal[i-1]){
                        //PositionSize[i] = (xxxtotal[i-1]-xxxtotal[i]);
                        Short[i] = sigScaleIn;
                }
                else if (xxxtotal[i]>xxxtotal[i-1]){
                        Cover[i] = sigScaleOut;
                }
        }
}


Reply via email to