Question submitted by Chid - 11, Nov 2016

AFL - prevent multiple buy signals from being generated

Hi Coding gurus,
Could someone help me to prevent multiple buy signals from being generated.
Scenio is as follows:

Buy = a >b OR c>d;
Sell = b>a or d>c;

Now I keep getting buy or sell signal in subsequent bars till the condition is true, I want to avoid buy signal till the time a fresh sell signal is generated. How to do it?

Harish - answered the above question

  • Harish (15, Nov 2016):
    You need to use ExRem function for this. For your code please add the following lines and that should work.
    
    Buy= ExRem( Buy, Sell);
    Sell= ExRem( Sell, Buy);