like
int shares = 0;
protected override void OnBarUpdate()
{
if(A){
enterlong(1, "initial");
shares = 1;
}
if(B){
enterlong(1,"add");
shares = shares +1
}
if(C){
entershort(shares , "exit");
shares = 0;
}
}
The problem is when i do backtesting, it has me "initial 1 @0.9095". And the next trade is exit 4 @0.9100, Close position 1 @0.9100. There should be another 3 "add 1 @***". Actually, the "add" trades never show up in the whole backtesting period even though I am very confident that the if(B) statement is triggered a lot (otherwise, exit won't sell more than 1).
Cam some one tell me why it does not add position?
Comment