Get Updates:
Email
Twitter
RSS

Enter your desired working stop-loss amount. Two lines are plotted representing the current bar high/low plus the average true range of the underlying (or any multiple thereof). If your desired stop amount falls within the boundaries of the envelope, the plot is blue. When the volatility increases such that your stop is probably insufficient, the plot turns red.

Average True Range Stop Validation

Average True Range Stop Validation

# ATRSTOPS
# (c) 2009 http://thinkscripter.wordpress.com
# thinkscripter@gmail.com
# Last Update 18 Jan 2009

input ATR_Multiple = 1.0;
input Desired_Stop_Loss = 1.0;
input ATR_period = 30;

def val = AvgTrueRange(high, close, low, ATR_period)*ATR_Multiple;

def tooVolatile = if(val>Desired_Stop_Loss,1,0);
def plotColor = if(tooVolatile,5,1);

plot LongStop = low-val;
LongStop.AssignValueColor(getColor(plotColor));
LongStop.setStyle(curve.SHORT_DASH);

plot ShortStop = high+val;
ShortStop.AssignValueColor(getColor(plotColor));
ShortStop.setStyle(curve.SHORT_DASH);

4 Responses to “Average True Range Stop Validation”

  1. Jim Karger says:

    Question: Where do you enter your stop loss amount?

  2. Go to the Study Properties panel and you will see “Desired Stop Loss”….
    Eric

  3. Blueman says:

    I tried using this study but the blue lines did not change color even my stop range was not sufficent as I had multiple stop outs. Any idea what could be the cause? I tried different settings but same result.
    Thanks.

Leave a Reply