Sell Plotshape Keep Appearing

Hi everyone
I need help to completed my AFL
Im using code to identify which buy and sell signal appear on my chart like in this article
http://www.amibroker.com/kb/2014/09/24/how-to-identify-which-signal-triggers/

im using shapedigit for buy and sell signal. the problem is, the sell signal keep appearing even the buy signal is not triggered and the shape causing to much noise to the chart, even after I use the exrem function. so can someone help me to completed it.
here the code

Buy1 = Condition1;
Buy2 = Condition2;
Buy3 = Condition3;
Sell1 = Condition4;
Sell2 = Condition5;

Buy = Buy1 OR Buy2 OR Buy3;
Sell = Sell1 or Sell2;

Buy = Exrem (Buy,Sell);
Sell = ExRem (Sell,Buy);

PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorbrightGreen, 0, L, Offset=-10);
PlotShapes(IIf(Sell,shapeSmallDownTriangle,shapeNone), colorRed, 0, H, Offset=-10);

BuyReason = EncodeColor(colorbrightGreen ) + WriteIf(Buy,"Buy signals: ","") 
           + WriteIf(buy1, "1.Cross_Line", "") +WriteIf(buy2, "2.Datar-Naik", "") 
           + WriteIf(buy3, "3.Turun-Naik", "");
           
SellReason = EncodeColor(colorGreen ) + WriteIf(Sell,",Sell signals: ","") 
           + WriteIf(Sell1, "1.CutLoss/TrailingStop", "")
           + WriteIf(Sell2, "2.Cross_Wilders", "");

PlotShapes (Buy1*shapedigit1, colorbrightGreen, 0, Low,-21);
PlotShapes (Buy2*shapedigit2, colorbrightGreen, 0, Low,-40);
PlotShapes (Buy3*shapedigit3, colorbrightGreen, 0, Low,-55);
PlotShapes (Sell1*shapedigit1, colorRed, 0, High,21);
PlotShapes (Sell2*shapedigit2, colorRed, 0, High,40);

the very first two plotshape signal appear and dissappear like I want, but the last two plotshape always appear If sell1 and sell2 conditions meet. please help to clear up the sell signal. Thanks for your help.

chart1

Hello galih_yudhi,
did you find some the solution?
I'm in the same problem.

Thanks

You might want to post your code and a snap unless you're using the same code. Are you ?

The simple problem in his case is he is complaining of Excess Digits when he has used ExRem()

ExRem is applied only in Buy and Sell variables;
and later in the code, he gets a brighter idea of plotting all 5 conditions separately. The code is doing exactly that.

yes I do.
I replaced plotshape function

Buyshape = Buy1*shapeDigit1 + Buy2*shapeDigit2 + Buy3*shapeDigit3 + Buy4*shapeDigit4;
SellShape = Sell1*shapeDigit1; // + Sell2*shapeDigit2;

PlotShapes(IIf(Buy,shapeSmallUpTriangle,shapeNone),colorbrightGreen, 0, L, Offset=-10);
PlotShapes(IIf(Sell,shapeSmallDownTriangle,shapeNone), colorRed, 0, H, Offset=-10);
PlotShapes(IIf(Buy,Buyshape,shapeNone),colorbrightGreen, 0, L, IIf (Buy1,-22,IIf (Buy2,-40,-55)));
PlotShapes(IIf(Sell,SellShape,shapeNone), colorRed, 0, H, IIf (Sell1,22,40));

hope this can help.

2 Likes