I would like to do following szenario in a 1-minute chart: I set a stop loss oder for an open position at 100. The quote does not fall below the stop. On the next day I want to set it to 99. I use "Bars.IsLastBarOfSession" which works great for backtesting. But in realtime usage (TWS) I run into the problem that the modification is made in the first seconds of the new day. This leads to execution based on the old stop (from previous day at 100).
My code is quite simple:
if ( Bars.IsLastBarOfSession && Position.MarketPosition == MarketPosition.Short ) {
SetStopLoss( "SL", CalculationMode.Percent, NextDaysSL, false );
SetProfitTarget( "PT", CalculationMode.Percent, NextDaysPT );
}
Any ideas or suggestions?
Martin
Comment