I am using Strategy Builder. The strategy works at the close of the bar so I have the setting at Bar Close. I want to use a trailing stop. Here’s the issue. First of all, the trailing only kicks in at the close of each bar. It looks like it reads the close and determines if that is past the amount of the trailing stop from the maximum (high on long, low on short) of that bar and then executes the trade at the close of the bar.. Also, if in the meantime it went negative the amount of the trailing stop, despite it having been in a profitable zone already, it will execute the trade at a loss of the entire trailing stop.
For example. I enter a trade at the close of a bar - sell short 1 future contract at 7415 with a trailing stop of 12 ticks. The next bar (15 min bar) it goes down to 7409 (profit of 24 ticks), and then reverses. When it hits 7418 (12 ticks loss from entry), it executes an exit trade.
So the strategy only reads the trailing stop at the close of each bar, but also executes it as a regular stop loss. That’s not how trailing stops are supposed to work.
If I change the setting to “on price change”, it enters the trade too early. I don’t want to enter until the close of a bar.
To summarize, I want to enter the trade at the close of the bar and have it read the trailing stop at each price change. How can I do this? Thanks.
That is how the managed trail stop works: it is recalculated each time OnBarUpdate runs, so with Calculate On bar close it only moves at the bar close, in backtests too. The usual fix: run the strategy On price change and keep entries on closed bars. Unlock the code, wrap the entry conditions in if (IsFirstTickOfBar) and shift their bar references from [0] to [1], so they read the bar that just closed. The trail then updates on every price change while entries still happen once per bar. For backtests, add a 1-tick series so the trail has intrabar prices. Happy to help further, feel free to DM me.