I have a running strategy with CalulateOnBarClose set to true.
Under this section --> protected override void Initialize(), I have CalculateOnBarClose = true;
Under this section --> protected override void OnBarUpdate(), I have SetTrailStop("entryname", CalculationMode.Ticks, STP_LOSS, false);
STP_Loss is a variable that I set when I enable the strategy
What I am trying to have happen is that entry signals are only triggered on bar close, which is what is happening.
However, I do not want the trailing stop loss calculated/adjusted only on bar close. I want the trailing stop to adjust real time, tick by tick, a set amount (STP_LOSS variable) behind the market.
I previously had settrailstop under Initialize(). It seemed that the stop wasn't trailing tick by tick so I moved it to OnBarUpdate().
Is the code above appropriate? Does it matter which section settrailstop is under?
Thanks,
m6
Comment