Exrem when we have multiple exits with Applystop

Hi

How do i use exrem when i have multiple exits in my system .For example:

buy=c>ma(c,20);
sell= adx(20)<25;

Applystop(stoptypeloss,stopModePoint,2*ATR(20));
ApplyStop( stopTypeNBar, stopModeBars, 5 );

So in above code there are 3 kinds of exits and i want to use exrem to remove duplicated signals.

Please read Different exits.

I have gone through that post. I had thought something like this:

buy=c>ma(c,20);
sell= adx(20)<25;
Equity(1,0);
Buy=exrem(buy,sell or sell==2 or sell==5);
sell=exrem(sell,buy);

Applystop(stoptypeloss,stopModePoint,2*ATR(20));
ApplyStop( stopTypeNBar, stopModeBars, 5 );

Above does not give the desired results, any idea why ?

Please go through the for-loop and switch-case previously shown by Tomasz in the previous link.

Also would request you to play with the examples shown here.

Since we are dealing with different exits using variables like Sell1, Sell2... are more suitable. Then I think you would be able to deal with ExRem( Buy, Sell1 ), ExRem( Buy, Sell2 ) ... separately.

1 Like

I just realized there was elementary programming error in my code. Now it works perfectly fine with exrem and no need of for loop, unless i have multiple buys as well.
Exrem buy and sell need to be put after applystop.