how to avoid trading when the market price is slight shocking?

 

for example:

if ((MACD <0.000X) ||(MACD>-0.000X)) return;

 
DxdCn:

for example:

if ((MACD <0.000X) ||(MACD>-0.000X)) return;

Wrong! Should be
if ((MACD < 0.000X) && (MACD > -0.000X)) return;

Or more efficiently
if (MACD < 0.000X)
    if (MACD > -0.000X)
        return;
 
if(MathAbs(MACD)<0.000X) return;
 

i know this . but i mean how to set good 0.000X? sometimes 0.0004 is good but some time 0.0005 is good , how to find the good 0.000x??

 
"Goodnes" is dependent from volatility, eg iATR(..14..) * 0.02.
Reason: