Custom Indicator /ES with $Tick Divergence

Trader_Vic

New member
VIP
Hi Guys! I joined this site a few months ago and this is such an amazing site for traders and coders to come together. I would need some help from someone who can write a code with this Strategy. I trade /ES on 5 Min & 1 Min Chart with $TICK as the bottom indicator. I usually draw lines every time there is a divergence or a flag formation for the TICKS to go Long or Short. I would need help from coders on this site to help me with the CODE.

vP6e5uS.png
 
Last edited by a moderator:
  • Like
Reactions: GOS

HigherLow

New member
I'd also be very interested in seeing this. I believe it already exists as a tradestation indicator which plots a dot at a price pivot when $tick confirms with its own high vs prior price pivots.
 

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
I found this, not sure if it's what you guys are looking for:

Code:
# $TICK Oscillator with Divergence
# Mobius
# V01.03.2020

declare lower;

input length = 5;
input AvgType = AverageType.HULL;

addLabel(1, "Green Line sloping up or red sloping down is divergence", color.white);
def o = open("$TICK");
def h = high("$TICK");
def l = low("$TICK");
def c = close("$TICK");
def x = BarNumber();
def nan = Double.NaN;
AddChart(h, l, c, o, ChartType.CANDLE, Color.YELLOW);
AddChart(h, l, o, c, ChartType.CANDLE, Color.CYAN);
def RTH = GetTime() >= RegularTradingStart(GetYYYYMMDD()) and
          GetTime() <= RegularTradingEnd(GetYYYYMMDD());
plot "0" = if !RTH then Double.NaN else 0;
     "0".SetDefaultColor(Color.MAGENTA);
     "0".HideBubble();
     "0".HideTitle();
plot avg = MovingAverage(AvgType, c, length);
     avg.AssignValueColor(if avg < 0
                          then color.red
                          else color.green);
     avg.HideBubble();
     avg.HideTitle();
addCloud(0, avg, color.red, color.green);
plot upArrow = if avg crosses above 0
               then l
               else double.nan;
     upArrow.SetPaintingStrategy(PaintingStrategy.Arrow_UP);
     upArrow.SetDefaultColor(Color.Green);
     upArrow.SetLineWeight(3);
     upArrow.HideBubble();
     upArrow.HideTitle();
plot dnArrow = if avg crosses below 0
               then h
               else double.nan;
     dnArrow.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN);
     dnArrow.SetDefaultColor(Color.Red);
     dnArrow.SetLineWeight(3);
     dnArrow.HideBubble();
     dnArrow.HideTitle();
def hh = if avg crosses above 0
         then h
         else if avg > 0 and h > hh[1]
         then h
         else hh[1];
def xh = if h == hh
         then x
         else xh[1];
plot hp = if x == highestAll(xh)
          then hh
          else nan;
     hp.SetStyle(Curve.Points);
     hp.SetDefaultColor(Color.red);
     hp.SetLineWeight(3);
     hp.HideBubble();
     hp.HideTitle();
def xh1 = if !isNaN(dnArrow)
          then getValue(xh, 2)
          else xh1[1];
plot hp1 = if x == highestAll(xh1)
           then h
           else nan;
     hp1.SetStyle(Curve.Points);
     hp1.SetDefaultColor(Color.red);
     hp1.SetLineWeight(3);
     hp1.HideBubble();
     hp1.HideTitle();
plot hd = if x == highestAll(xh1)
          then h
          else if x == highestAll(xh)
          then h
          else nan;
     hd.EnableApproximation();
     hd.SetDefaultColor(Color.red);
     hd.HideBubble();
     hd.HideTitle();
def ll = if avg crosses below 0
         then l
         else if avg < 0 and l < ll[1]
         then l
         else ll[1];
def xl = if l == ll
         then x
         else xl[1];
plot lp = if x == highestAll(xl)
          then ll
          else nan;
     lp.SetStyle(Curve.Points);
     lp.SetDefaultColor(Color.green);
     lp.SetLineWeight(3);
     lp.HideBubble();
     lp.HideTitle();
def xl1 = if !isNaN(dnArrow)
          then xl[1]
          else xl1[1];
plot lp1 = if x == highestAll(xl1)
           then l
           else nan;
     lp1.SetStyle(Curve.Points);
     lp1.SetDefaultColor(Color.green);
     lp1.SetLineWeight(3);
     lp1.HideBubble();
     lp1.HideTitle();
plot ld = if x == highestAll(xl1)
          then l
          else if x == highestAll(xl)
          then l
          else nan;
     ld.EnableApproximation();
     ld.SetDefaultColor(Color.green);
     ld.HideBubble();
     ld.HideTitle();
# End Code TICK Oscillator with Divergence


# AI Adds

def lastHP = if x == highestAll(xh)
then xh else lastHP[1];
def lastHP1 =  if x == highestAll(xh1)
then xh1 else lastHP[1];
def lastLP = if x == highestAll(xl)
then xl else lastLP[1];
def lastLP1 =  if x == highestAll(xl1)
then xl1 else lastLP1[1];

Addlabel(lastHP1<lastHP,"Divergent",color.red);
Addlabel(lastLP1>lastLP,"Divergent",color.green);
 

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