How do i create alert using alertif function on value above atr >0.85


AddColumn(ROC(ATR(15),1),"%ATR_Moves",1.2);
ATR_change = (ATR(15)-Ref(ATR(15),-1));
atrfcrs = ATR_change>=0.85;
ATR_changeresult = Cross(ATR_change,atrfcrs);                                                                      //(ATR(15)-Ref(ATR(15),-1))>=0.85;
AddColumn(ATR_change,"ATR_chg(0.85)",1.4,colorBlack,IIf(ATR_change<1000 and ATR_change>=0.85,colorYellow,colorDefault));
AddColumn(ATR(15),"ATR_15",1.4);
AlertIf(ATR_changeresult,"","ATR_moves"+FullName() + "@"+ATR_change,1 );

Screenshot 2021-12-30 131416

I get this negative value above in image, in alert output i want value >=0.85 please anyone help me

thanks in advance

@fxlaiq, I'm not sure to correctly understand what you are looking for, but maybe you should use the ABS() function to get the absolute value of your calculations, (i.e. apply it to the ATR_change variable).

In such a case, please, see the documentation: abs( NUMBER )

1 Like

That one is not proper.
You are comparing apples (ATR chg. value) to oranges (atrfcrs boolean result).
That's why you get negative results.

So use:

Buy = atrfcrs;
AlertIf(Buy,"","ATR_moves"+FullName() + "@"+ATR_change,1 );
2 Likes

Thanks you so much @beppe and @fxshrat

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