Issue in using Exrem function

Hello experts....First of all, really wanted to thank every active member here. I have been a frequent visitor of this page and have learnt lot of new things from here. The way experts help novices like me with the code and then explain their logic is really appreciated.

I am still a novice and have a query with the below code -

Cond1 = Volume > EMA(Volume, 20) * 2;
Cond2 = Volume < EMA(Volume, 20) * 0.00003;

Buy= Cond1;
Sell= Cond2;
Buy = Exrem (Buy, Sell);
Sell = Exrem (Sell, Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeHollowDownTriangle, shapeNone),colorRed, 0,H, Offset=-65);

Filter = Buy OR Sell ;

AddColumn(C,"Close");
AddColumn(H,"High");
AddColumn(L,"Low");
AddColumn( Buy, "Buy", 1, colorDefault, IIf( Buy, colorGreen, colorDefault ) );
AddColumn( Sell, "Sell", 1, colorDefault, IIf( Sell, colorRed, colorDefault ) );

I want to explore the stocks with volume > 2x of EMA Volume of last 20 candles. The issue is-

  1. If I am not putting the Exrem lines, I am getting the correct output, but then I am getting more than one signal per day whenever the condition is met (which I don't want).
  2. If I am putting the Exrem lines, I am not getting the correct output.

Request help on this issue. Thanks

@Suraj, Welcome to the Forum.

For posting questions on the forum, you are required to get "Verified". Please SEARCH for "Verified" or "Verified Badge" and follow the steps.

Additionally, when you are posting code, please use the CODE BLOCKS ("</>"). This allows others to quickly and easily get a copy of your code for testing.

Other helpful information is what Version of AB you are using, and what TimeFrame you are in.

1 Like
Cond1 = Volume > EMA(Volume, 20) * 2;
Cond2 = Volume < EMA(Volume, 20) * 0.00003;

Buy= Cond1;
Sell= Cond2;
Buy = Exrem (Buy, Sell);
Sell = Exrem (Sell, Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeHollowDownTriangle, shapeNone),colorRed, 0,H, Offset=-65);

Filter = Buy OR Sell ;

AddColumn(C,"Close");
AddColumn(H,"High");
AddColumn(L,"Low");
AddColumn( Buy, "Buy", 1, colorDefault, IIf( Buy, colorGreen, colorDefault ) );
AddColumn( Sell, "Sell", 1, colorDefault, IIf( Sell, colorRed, colorDefault ) );

I am using Amibroker 6.2 and the timeframe used in 1 hour.

Don't forget to get verified...