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

  • Thread starter GetRichOrDieTrying
  • Start date
G

GetRichOrDieTrying

Member
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

BenTen

Administrative
Staff
VIP
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);
 
G

GetRichOrDieTrying

Member
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
 
G

GetRichOrDieTrying

Member
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.
 
BenTen

BenTen

Administrative
Staff
VIP
@GetRichOrDieTrying In that case I don't think Renko is supported.
 
Y

younglove06

New 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

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!
 
Y

younglove06

New 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

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!
 
markos

markos

Well-known member
VIP
@GetRichOrDieTrying Along with saying thanks, it's always good form to click the little "like" button to the right. (yes,after the fact I saw that you did above, thanks) (y)
Never in a "Million years" did I expect to see to Renko Bar people on this site. :eek: That's pretty cool. :cool:
 
Y

younglove06

New 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.
 
markos

markos

Well-known member
VIP
Since you brought it up, please post what you have for the group in a new Thread. Much Appreciated.
 
D

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!
 
Y

younglove06

New 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!
 
G

GetRichOrDieTrying

Member
Is it possible to use this for Heiken Ashi Candle color changes? I'd like to get an alert only when a red candle closes.
 

Similar threads

Top