The code looks back 2 bars. It compares values in the prior bar (say bar[1]) to the bar before the prior bar (say bar[2]). In this sense, Calculate.OnBarClose should work fine. However, the entry is based on the current bar (say bar[0]) breaking the high or the low of bar[1]. Once that high or low of bar[1] is broken on bar[0], a “EnterLong” or “EnterShort” is true and the trade is entered. My concern on setting this to CalculateOnBarClose is, would the strategy wait until bar[0] closes before the trade is entered OR would the trade still occur on bar[0] once the high or low is broken?
The problem I am having now with CalculateOnEachTick is if I hit my profit target on the same bar as the entry, the trade fires again even though this new entry is beyond my profit target. My assumption is CalculateOnBarClose will fix this, but I need to confirm it won’t negatively impact the entry logic.
Thanks
Comment