protected override void Initialize() { SetTrailStop("MySignal", CalculationMode.Ticks, sl_size, false); TraceOrders = true; CalculateOnBarClose = false; } protected override void OnBarUpdate() { if (CheckLongConditions()) { if (Position.MarketPosition != MarketPosition.Long) { EnterLong(DefaultQuantity, "RenRev"); Print("Enter LONG at " + Close[0]); } } if (CheckShortConditions()) { if (Position.MarketPosition != MarketPosition.Short) { EnterShort(DefaultQuantity, "RenRev"); Print("Enter SHORT at " + Close[0]); } } }
In backtest it works fine. But in live simulated trading, first trade is OK, but second trade (and all other trades) is realized with TWO contracts instead of one contract only.
Problem is that I don't know, why does it behave this way.
May be small screenshot should help anybody to answe me.
On screen is first trade (11:41:57] with 1 contract, it exited at 12:10:04 using trail stop - and after that there is some Close positon which cause to sell second contract - but I don't want it!
After this I enter new trade (its name is RenRev) and I add second short contract this way. After that again Trail stop with ONE contract and Close position with TWO contracts. What does it mean "Close position"? Why is it executed?
Comment