The strategy places an order in the OnBarUpdate method.
I am checking to make sure it is flat prior to entry and the setting a limit order and a calulated target and stop.
EnterLongLimit(_price, tt.Name);
// set target and stop
_s = _price - (tt.OptimalStop * TickSize);
_t = _price + ((tt.OptimalTarget - OffsetBuffer) * TickSize);
SetStopLoss(CalculationMode.Price, _s);
SetProfitTarget(CalculationMode.Price, _t);
Everything works fine, target (or stop) is hit and the position is closed.
On the strategy (under the position column) will still say that it is long.
If I stop and start, everything is cleared and the strategy is ready to trade again.
I added some code to check Position and PositionAccount:
Print("strategy " + Position.MarketPosition);
Print("account " + PositionAccount.MarketPosition);
The account shows Flat and the strategy shows long. Eventually the strategy goes flat and will trade again.
I have no other trade management in the strategy yet.
Comment