Whenever you include a screenshot of a chart, be sure to include the entire view of the chart. As I have done here. Make sure the full chart is included, showing the ticker symbol, time frame, and date range at the bottom.
I am going to break from my normal practice of always including the entire code in the solution. This is only because the code for this indicator is 3 miles long and would be ridiculous to include here. Especially when the stated goal is reached by adding only a single line of code.
input trailType = {default modified, unmodified};
input ATRPeriod = 5;
input ATRFactor = 3.5;
input firstTrade = {default long, short};
input averageType = AverageType.WILDERS;
def thisATR = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType).TrailingStop;
AddLabel(yes, if close > thisATR then "Buy Signal" else "SellSignal", if close > thisATR then Color.GREEN else Color.RED);
Screenshot shows the watchlist column in action.
Ok, one small tweak to complete the specification. In it’s original state the code only checks if the indicator is bullish or bearish. In order to update this so that it only triggers on the first bar in a new direction, replace the AddLabel() statement with this one:
AddLabel(yes, if close > thisATR and close[1] < thisATR[1] then "Buy Signal" else if close < thisATR and close[1] > thisATR[1] then “SellSignal” else “No Signal”, if close > thisATR and close[1] < thisATR[1] then Color.GREEN else if close < thisATR and close[1] > thisATR[1] then Color.RED else Color.CURRENT);
You’re amazing Pete ? Thank you brother !