Trailing Stop Alert Column


Category:
0
0

Hello traders,
I’ve been using the trailing stop for a while & I’m looking for a watchlist column that shows the indicator’s transitions from Buy (green) to Sell (red). Attached are some screenshots of the indicator and a potential column idea. Buy signal for green transition and Sell signal for a red transition. Thanks guys. Happy trading

Attachments:
Marked as spam
Posted by (Questions: 11, Answers: 10)
Asked on June 9, 2018 2:23 pm
452 views
0
Private answer

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.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on June 9, 2018 3:35 pm
0

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);

( at June 9, 2018 3:43 pm)
0

You’re amazing Pete ? Thank you brother !

( at June 10, 2018 3:48 am)
0
I am trying to add this watchlist. Could you please share the full code for that?
( at January 1, 2021 7:30 am)
0
Everything you need is included in my answer. Just copy and paste the code into custom watchlist column and it works exactly as shown in the example screenshot.
( at January 1, 2021 9:30 am)