i have made a strategy and tested it on playback mode succesffully but when i use it on a eval account nothing happens or when and order is submitted it auto close instantly. I encountered the same issue in play back mode and bypassed it by setting isSimulatedStop=true in setstoploss function, but it doesn't workd in live/eval. So i decided to made a simple strategy :
protected override void OnBarUpdate()
{
//Add your custom strategy logic here.
if(Close[0]>Open[0] && Position.MarketPosition==MarketPosition.Flat){
EnterLong(1,"Long");
SetStopLoss("Long", CalculationMode.Price, Low[0]-20, true);
}
if(Close[0]<Open[0] && Position.MarketPosition==MarketPosition.Flat){
EnterShort(1,"Short");
SetStopLoss("Short", CalculationMode.Price, High[0]+20, true);
}
}
When i use it in sim/live with these properties :
Maximum bars look back : Infinite
Bars required to trade : 1
Start behavior : Wait until flat
Then nothing happen and sometimes an order is filled and autoclose..
Thanks for your help

Comment