ATR Breakout indicator help
Hi, I was wondering if anyone has an idea on how to convert this thinkorswim (thinkcript) study to tradovate. The code is really simple in thinkscript but i'm not too familiar with javascript.
The study plots 4 lines:
I'm pretty sure the code plots 2 lines at plus and minus 1ATR and 2ATR of a 50 period exponential moving average.
def long_entry = (ExpAverage(close, 50)) + (2 * ATR(20));
def short_entry = (ExpAverage(close, 50)) - (2 * ATR(20));
def short_stop_loss = (ExpAverage(close, 50)) + (ATR(20));
def long_stop_loss = (ExpAverage(close, 50)) - (ATR(20));
plot b_entry = long_entry;
plot s_entry = short_entry;
plot s_stop = short_stop_loss;
plot l_stop = long_stop_loss;
b_entry.SetDefaultColor(GetColor(6));
s_entry.SetDefaultColor(GetColor(5));
s_stop.SetDefaultColor(GetColor(1));
l_stop.SetDefaultColor(GetColor(0));
I have also seen in coded in tradingview
plot(ema(close,50) + (2*atr(20)), "Long Entry Threshold", color=green, style=line)
plot(ema(close,50) - (2*atr(20)), "Short Entry Threshold", color=red, style=line)
plot(ema(close,50) + (atr(20)), "Short Stop Loss", color=blue, style=line)
plot(ema(close,50) - (atr(20)), "Long Stop Loss", color=black, style=line)
Please sign in to leave a comment.
Comments
0 comments