Need Help on Exit condition

Hello Experts,

I am new to AFL programming hence seeking your help/advice my strategy.

I have collected publicly available Supertrend and Choppiness indicator and used it for strategy.

Idea is to go long if Supertrend is showing long and choppiness is less than 40 and go to sell if Supertrend is showing sell and choppiness is less than 40. This condition is working perfectly however i have challenges in short and cover conditions.

In my exit conditions i have added below mentioned lines

Cp_short = Close > st OR Cross (Chop, 70); // Either Supretrend changed the direction or choppiness crossed 70
Cp_cover = Close < st OR Cross (Chop, 70); // Either Supretrend changed the direction or choppiness crossed 70

The short and cover conditions are not working as expected, i just need to exit only if i supertrend already showed buy or sell (could be some bars back), and then choppiness crosses above 70.

Thanks in advance.

The Cross() function returns True when the first argument crosses above the second argument, so both your Short and Cover conditions are looking for Chop to cross ABOVE 70. Is that what you intended?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.