So, for a long position the Action coding looks like:
EnterLongLimit(NmbrContractsPT1, GetCurrentAsk(), "Entry1 DD")
EnterLongLimit(NmbrContractsPT2, GetCurrentAsk(), "Entry2 DD")
In set Stops and Targets I have:
SetProfitTarget("Entry1 DD", CalculateMode.Ticks, PrftTrgt1)
SetProfitTarget("Entry2 DD", CalculateMode.Ticks, PrftTrgt2)
Now I have a Condition that when true I want to go flat/close the position. I have in the Action section:
ExitLong("Stop1", "Entry1 DD")
ExitLong("Stop1", "Entry1 DD")
Now when BackTesting using the Strategy Analyzer the above to statements to exit the position appears to work fine. Those two statements appear to work fine on historical data when the Strategy is applied to a chart.
However I have a problem in real-time. If none of the Profit Targets have been met but but my flat/close position condition is true then it takes two bars to close the position. 'Entry1 DD' is closed on the first bar and 'Entry2 DD' is closed on the 2nd bar. As I said: in backtesting and on historical data the whole position is always closed on the 1st bar that the flat/close condition is true. In real-time it always takes 2 bars to close out the position if none of the Profit Targets have been met.
If Profit Target1 has been met and the flat/close condition is then met. The 'Entry2 DD' is closed on the 1st bar.
It would appear that when you have multiple active positions then only 1 ExitLong statement can be worked per bar.
Strategy parameter settings:
Entries per direction = 2
Entry handling = UniqueEntries
Comment