ignapaillet
New member
Expert Trend Locator (XTL) For ThinkOrSwim
I'm looking for help.
I want to create a Watchlist Column that displays "Bullish", "Neutral" or "Bearish" based on the Expert Trend Locator (XTL).
Thank you very much for your help!
helps you to easily define in what kind of trend you are.
Its calculation is based on CCI and a fixed value of that indicator:
- if CCI value<-fixed value you're in a short trend (red bars);
- if -fixedvalue<=CCI<=+fixedvalue you are in a non trend/flat period (white bars);
- if CCI>fixed value you're in a long trend period (cyan bars);
Code:
input period = 35;
input paintBars = yes;
def fixedValue = 37;
def sma = SimpleMovingAvg(10);
def GreenPrice = CCI(period) > fixedValue;
def RedPrice = CCI(period) < -fixedValue;
def NeutralPrice = -fixedValue <= CCI(period) and CCI(period) <= fixedValue;
plot Bullish = GreenPrice;
plot Neutral = NeutralPrice;
plot Bearish = RedPrice;
Bullish.SetDefaultColor(Color.CYAN);
Bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bullish.SetLineWeight(3);
Bullish.hide();
Neutral.SetDefaultColor(Color.WHITE);
Neutral.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Neutral.SetLineWeight(3);
Neutral.hide();
Bearish.SetDefaultColor(Color.RED);
Bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Bearish.SetLineWeight(3);
Bearish.hide();
DefineGlobalColor("Bullish", Color.CYAN);
DefineGlobalColor("Neutral", Color.WHITE);
DefineGlobalColor("Bearish", Color.RED);
AssignPriceColor(if !paintBars then Color.CURRENT else if GreenPrice then globalColor("Bullish") else if RedPrice then globalColor("Bearish") else globalColor("Neutral"));
I'm looking for help.
I want to create a Watchlist Column that displays "Bullish", "Neutral" or "Bearish" based on the Expert Trend Locator (XTL).
Thank you very much for your help!
Last edited by a moderator: