Found this interesting script on TradingView. I think it's based on Jim Berg's ATR Volatility Based System.
thinkScript Code
Code:
# ATR Volatility Based System Jim Berg
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/UxWO2H5P/
input length = 10;
def EntrySignal = close > (lowest(low, 20) + 2 * atr(Length));
def ExitSignal = close < (highest(high, 20) - 2 * atr(Length));
def TrailStop = highest(close - 2 * atr(Length), 15);
def ProfitTaker = expAverage(high, 13) + 2 * atr(Length);
assignPriceColor(if EntrySignal then Color.GREEN else if ExitSignal then Color.RED else Color.WHITE);
def entry = ((lowest(low, 20)) + 2 * atr(Length));
def exit = ((highest(high, 20)) - 2 * atr(Length));
plot trail = TrailStop;
plot profit_taker = ProfitTaker;
trail.SetDefaultColor(GetColor(0));
profit_taker.SetDefaultColor(GetColor(1));
AddCloud(entry, exit, color.yellow, color.yellow);
Attachments
Last edited: