I am working with an ATM Strategy. I have a manually coded trailing stop, and a second set of rules that closes the ATM Strategy if the trailing stop is adjusted higher than the current price. I have noticed that when ATMStrategyClose() is invoked the long position is closed but the strategy opens a short position even though there are no rules to allow that. How can I ensure that the strategy waits for another long entry signal before entering another long trade, rather than going short?
// Change the stop if the close is above the currentlevel
if (GetAtmStrategyMarketPosition(atmStrategyId) == MarketPosition.Long && Close[0] > CurrentLevel)
{
AtmStrategyChangeStopTarget(0, InitialY + (Slope1 * BarsElapsed), "STOP1", atmStrategyId);
}
// Close if close below current level
else if (GetAtmStrategyMarketPosition(atmStrategyId) == MarketPosition.Long && Close[0] < CurrentLevel)
{
AtmStrategyClose(atmStrategyId);
}

Comment