Is it possible to create a Renko Reversal Alert on ThinkOrSwim?

Does anyone know if it's possible to create a Renko Reversal Alert on Thinkorswim, and if there is a way to create alerts for Renko Charts when the MACD lines cross?
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
What does Renko have anything to do with MACD alert? Renko is just merely another type of candlestick chart. You would need to include a code snippet to enable alert for MACD crossovers.

Try this for MACD:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2019
#

declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

# Alerts
Alert(UpSignal, " ", Alert.Bar, Sound.Chimes);
Alert(DownSignal, " ", Alert.Bar, Sound.Bell);
 
I mentioned Renko, because when you setup an alert, you have to select a timeframe, but since Renko doesn't use time, I need to know how to work around that. I copy and pasted your code and got this error: Exactly one plot expected

As far as a MACD Crossover alert, I created this, which would work: MACD()."Value" crosses above MACD()."Avg". The problem is that you have to select a timeframe. That's what I'm trying to work around.
 

younglove06

Member
2019 Donor
I use Renko bars too, so I created this code awhile ago to alert me when the bricks change direction. Did you want the alert when the brick of the new direction first opens, or when the first brick of the new direction closes?
 

markos

Well-known member
VIP
I use Renko bars too, so I created this code awhile ago to alert me when the bricks change direction. Did you want the alert when the brick of the new direction first opens, or when the first brick of the new direction closes?
@younglove06 Please share the study code here. Some will want when it opens, some will want it when it closes. Thanks for being part of the community!
 

younglove06

Member
2019 Donor
These codes are good for timed candles also, not just Renkos.

This is my first contribution to this form, so let me know if there are questions.

Brick change from Up to Down(alert sounds at the open of the first brick).

Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsUp[1] and

    IsDown[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(255, 0, 0));



AddLabel(PatternPlot, "TREND CHANGE", if PatternPlot then Color.RED else color.current);



Alert(PatternPlot, "sell signal", Alert.BAR, Sound.Ring);

Brick change from Up to Down(alert sounds at the close of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsUp[1] and

    IsDown[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(255, 0, 0));



AddLabel(PatternPlot[1], "TREND CHANGE", if PatternPlot[1] then Color.RED else color.current);



Alert(PatternPlot[1], "sell signal", Alert.BAR, Sound.Ring);

Brick change from Down to Up(alert sounds at the open of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsDown[1] and

    IsUp[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(0, 255, 0));



AddLabel(PatternPlot, "TREND CHANGE", if PatternPlot then Color.GREEN else color.current);



Alert(PatternPlot, "buy signal", Alert.BAR, Sound.Ring);

Brick change from Down to Up(alert sounds at the close of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsDown[1] and

    IsUp[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(0, 255, 0));



AddLabel(PatternPlot[1], "TREND CHANGE", if PatternPlot[1] then Color.GREEN else color.current);



Alert(PatternPlot[1], "buy signal", Alert.BAR, Sound.Ring);
 
Last edited:

markos

Well-known member
VIP
@younglove06 Thank you for the codes. Congrats on your first post!
One thing... look above the reply bar for this symbol </> and click it. Put each code in there by itself and it will preserve the formatting. Thanks!
 

younglove06

Member
2019 Donor
Oh and as far as the MACD crossover, are you looking for an alert when the two lines cross or are you looking for an alert when the market goes above/below the zero line?

In thinkorswim, the two lines crossing is under "MacdTwoLines" and then the other one is just the regular Histogram. For either of these two, I do have a code for the alert.
 

diazlaz

Well-known member
2019 Donor
VIP
These codes are good for timed candles also, not just Renkos.

This is my first contribution to this form, so let me know if there are questions.

Brick change from Up to Down(alert sounds at the open of the first brick).

Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsUp[1] and

    IsDown[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(255, 0, 0));



AddLabel(PatternPlot, "TREND CHANGE", if PatternPlot then Color.RED else color.current);



Alert(PatternPlot, "sell signal", Alert.BAR, Sound.Ring);

Brick change from Up to Down(alert sounds at the close of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsUp[1] and

    IsDown[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(255, 0, 0));



AddLabel(PatternPlot[1], "TREND CHANGE", if PatternPlot[1] then Color.RED else color.current);



Alert(PatternPlot[1], "sell signal", Alert.BAR, Sound.Ring);

Brick change from Down to Up(alert sounds at the open of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsDown[1] and

    IsUp[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(0, 255, 0));



AddLabel(PatternPlot, "TREND CHANGE", if PatternPlot then Color.GREEN else color.current);



Alert(PatternPlot, "buy signal", Alert.BAR, Sound.Ring);

Brick change from Down to Up(alert sounds at the close of the first brick)
Code:
def IsUp = close > open;

def IsDown = close < open;

def IsDoji = IsDoji();

def avgRange = 0.05 * Average(high - low, 20);

plot PatternPlot =

    IsDown[1] and

    IsUp[0];



PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);

PatternPlot.SetDefaultColor(CreateColor(0, 255, 0));



AddLabel(PatternPlot[1], "TREND CHANGE", if PatternPlot[1] then Color.GREEN else color.current);



Alert(PatternPlot[1], "buy signal", Alert.BAR, Sound.Ring);

Thanks for this! Nice set.

Do you need to adjust average to tick size for it to work properly?

I have to look at my indicators, might have a few that will compliment these.

Thanks!
 

younglove06

Member
2019 Donor
Thanks for this! Nice set.

Do you need to adjust average to tick size for it to work properly?

I have to look at my indicators, might have a few that will compliment these.

Thanks!

Actually you just add it like any other indicator, so you will have already have set your tick size with the bars. So no matter how many ticks you set it for, whenever a new brick forms, you will get an alert, at the open or the close, depending on which codes you use. Or if you use them both, you will get an alert when a new brick both opens and closes. And YW!
 

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Top