MTF Dashboard Heiken Ashi Labels

iMauiC

Member
Ok so a lot of this coding I borrowed from the other thread: https://usethinkscript.com/threads/the-multi-10x-mtf-labels-indicator-for-thinkorswim.1129/

But essentially I was able to build this Moving average 10x Label system, but I need a little more help if anyone can please help me out.
I'm trying to get a neutral level to for the labels to paint when Price gets near the Heiken ashi moving average of + or - $2 for the underlying asset.
If anyone can please help me out on this.

Code:
#Heiken Ashi Moving Average 10x Label System.

def length1 = 9;
input showlabels = yes; #show labels

input show1MIN = yes; #show ONE MINUTE label
input show2MIN = yes; #show TWO MINUTES label
input show3MIN = yes; #show THREE MINUTES label
input show4MIN = yes; #show FOUR MINUTES label
input show5MIN = yes; #show FIVE MINUTES label
input show10MIN = yes; #show TEN MINUTES label
input show15MIN = yes; #show FIFTEEN MINUTES label
input show20MIN = yes; #show TWENTY MINUTES label
input show30MIN = yes; #show THIRTY MINUTES label
input show1HOUR = yes; #show HOUR label
input show2HOUR = yes; #show TWO HOURS label
input show4HOUR = yes; #show FOUR HOURS label
input show1DAY = yes; #show ONE DAY label
input show2DAY = yes; #show TWO DAYS label
input show3DAY = yes; #show THREE DAYS label
input show4DAY = yes; #show FOUR DAYS label
input showWEEK = yes; #show ONE WEEK label
input showMONTH = yes; #show ONE MONTH label

DefineGlobalColor("Bullish", Color.Uptick);
DefineGlobalColor("Bearish", Color.Downtick);
DefineGlobalColor("Neutral", Color.YELLOW);

AddLabel(yes, "10X HAMA", Color.CYAN);

def currentTimeFrame = getAggregationPeriod();
#assert(currentTimeFrame == AggregationPeriod.MIN, "ERROR: timeFrame needs to be 1 minute");

################# 1MIN ################
def HAopen1;
def HAhigh1;
def HAlow1;
def HAclose1;
def aM1 = if currentTimeFrame <= aggregationPeriod.MIN then aggregationPeriod.MIN else currentTimeFrame;;
def M1A = if currentTimeFrame <= aggregationPeriod.MIN then yes else no;
def h1 = high(period = aM1);
def l1 = low(period = aM1);
def c1 = close(period = aM1);
def o1 = open(period = aM1);

HAopen1 = CompoundValue(1, (HAopen1[1] + HAclose1[1]) / 2, (o1[1] + c1) / 2);
HAhigh1 = Max(h1, c1[1]);
HAlow1 = Min(l1, c1[1]);
HAclose1 = (HAopen1 + HAclose1[1] + HAlow1 + c1) / 4;
def HAMA1 = Average(HAclose1, length1);


def bullishM1 = c1 > HAMA1;
def bearishM1 = c1 < HAMA1;

AddLabel(showlabels and show1min and m1a, "1MIN", if bullishM1 then GlobalColor("Bullish") else
 if bearishM1 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 2MIN ################
def HAopen2;
def HAhigh2;
def HAlow2;
def HAclose2;
def aM2 = if currentTimeFrame <= aggregationPeriod.TWO_MIN then aggregationPeriod.TWO_MIN else currentTimeFrame;;
def M2A = if currentTimeFrame <= aggregationPeriod.TWO_MIN then yes else no;
def h2 = high(period = aM2);
def l2 = low(period = aM2);
def c2 = close(period = aM2);
def o2 = open(period = aM2);

HAopen2 = CompoundValue(1, (HAopen2[1] + HAclose2[1]) / 2, (o2[1] + c2) / 2);
HAhigh2 = Max(h2, c2[1]);
HAlow2 = Min(l2, c2[1]);
HAclose2 = (HAopen2 + HAclose2[1] + HAlow2 + c2) / 4;
def HAMA2 = Average(HAclose2, length1);


def bullishM2 = c2 > HAMA2;
def bearishM2 = c2 < HAMA2;

AddLabel(showlabels and show2min and m2a, "2MIN", if bullishM2 then GlobalColor("Bullish") else
 if bearishM2 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 5MIN ################
def HAopen3;
def HAhigh3;
def HAlow3;
def HAclose3;
def aM3 = if currentTimeFrame <= aggregationPeriod.five_MIN then aggregationPeriod.five_MIN else currentTimeFrame;;
def M3A = if currentTimeFrame <= aggregationPeriod.five_MIN then yes else no;
def h3 = high(period = aM3);
def l3 = low(period = aM3);
def c3 = close(period = aM3);
def o3 = open(period = aM3);

HAopen3 = CompoundValue(1, (HAopen3[1] + HAclose3[1]) / 2, (o3[1] + c3) / 2);
HAhigh3 = Max(h3, c3[1]);
HAlow3 = Min(l2, c2[1]);
HAclose3 = (HAopen3 + HAclose3[1] + HAlow3 + c3) / 4;
def HAMA3 = Average(HAclose3, length1);


def bullishM3 = c3 > HAMA3;
def bearishM3 = c3 < HAMA3;

AddLabel(showlabels and show5min and m3a, "5MIN", if bullishM3 then GlobalColor("Bullish") else
 if bearishM3 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 10MIN ################
def HAopen4;
def HAhigh4;
def HAlow4;
def HAclose4;
def aM4 = if currentTimeFrame <= aggregationPeriod.ten_MIN then aggregationPeriod.ten_MIN else currentTimeFrame;;
def M4A = if currentTimeFrame <= aggregationPeriod.ten_MIN then yes else no;
def h4 = high(period = aM4);
def l4 = low(period = aM4);
def c4 = close(period = aM4);
def o4 = open(period = aM4);

HAopen4 = CompoundValue(1, (HAopen4[1] + HAclose4[1]) / 2, (o4[1] + c4) / 2);
HAhigh4 = Max(h4, c4[1]);
HAlow4 = Min(l4, c4[1]);
HAclose4 = (HAopen4 + HAclose4[1] + HAlow4 + c4) / 4;
def HAMA4 = Average(HAclose4, length1);


def bullishM4 = c4 > HAMA4;
def bearishM4 = c4 < HAMA4;

AddLabel(showlabels and show10min and m4a, "10MIN", if bullishM4 then GlobalColor("Bullish") else
 if bearishM4 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 15MIN ################
def HAopen5;
def HAhigh5;
def HAlow5;
def HAclose5;
def aM5 = if currentTimeFrame <= aggregationPeriod.fifteen_MIN then aggregationPeriod.fifteen_MIN else currentTimeFrame;;
def M5A = if currentTimeFrame <= aggregationPeriod.fifteen_MIN then yes else no;
def h5 = high(period = aM5);
def l5 = low(period = aM5);
def c5 = close(period = aM5);
def o5 = open(period = aM5);

HAopen5 = CompoundValue(1, (HAopen5[1] + HAclose5[1]) / 2, (o5[1] + c5) / 2);
HAhigh5 = Max(h5, c5[1]);
HAlow5 = Min(l5, c5[1]);
HAclose5 = (HAopen5 + HAclose5[1] + HAlow5 + c5) / 4;
def HAMA5 = Average(HAclose5, length1);


def bullishM5 = c5 > HAMA5;
def bearishM5 = c5 < HAMA5;

AddLabel(showlabels and show15min and m5a, "15MIN", if bullishM5 then GlobalColor("Bullish") else
 if bearishM5 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 30MIN ################
def HAopen6;
def HAhigh6;
def HAlow6;
def HAclose6;
def aM6 = if currentTimeFrame <= aggregationPeriod.thirty_MIN then aggregationPeriod.thirty_MIN else currentTimeFrame;;
def M6A = if currentTimeFrame <= aggregationPeriod.thirty_MIN then yes else no;
def h6 = high(period = aM6);
def l6 = low(period = aM6);
def c6 = close(period = aM6);
def o6 = open(period = aM6);

HAopen6 = CompoundValue(1, (HAopen6[1] + HAclose6[1]) / 2, (o6[1] + c6) / 2);
HAhigh6 = Max(h6, c6[1]);
HAlow6 = Min(l6, c6[1]);
HAclose6 = (HAopen6 + HAclose6[1] + HAlow6 + c6) / 4;
def HAMA6 = Average(HAclose6, length1);


def bullishM6 = c6 > HAMA6;
def bearishM6 = c6 < HAMA6;

AddLabel(showlabels and show30min and m6a, "30MIN", if bullishM6 then GlobalColor("Bullish") else
 if bearishM6 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 1HR ################
def HAopen7;
def HAhigh7;
def HAlow7;
def HAclose7;
def aM7 = if currentTimeFrame <= aggregationPeriod.hour then aggregationPeriod.hour else currentTimeFrame;;
def M7A = if currentTimeFrame <= aggregationPeriod.hour then yes else no;
def h7 = high(period = aM7);
def l7 = low(period = aM7);
def c7 = close(period = aM7);
def o7 = open(period = aM7);

HAopen7 = CompoundValue(1, (HAopen7[1] + HAclose7[1]) / 2, (o7[1] + c7) / 2);
HAhigh7 = Max(h7, c7[1]);
HAlow7 = Min(l7, c7[1]);
HAclose7 = (HAopen7 + HAclose7[1] + HAlow7 + c7) / 4;
def HAMA7 = Average(HAclose7, length1);


def bullishM7 = c7 > HAMA7;
def bearishM7 = c7 < HAMA7;

AddLabel(showlabels and show1hour and m7a, "1HR", if bullishM7 then GlobalColor("Bullish") else
 if bearishM7 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 2HR ################
def HAopen8;
def HAhigh8;
def HAlow8;
def HAclose8;
def aM8 = if currentTimeFrame <= aggregationPeriod.two_hours then aggregationPeriod.two_hours else currentTimeFrame;;
def M8A = if currentTimeFrame <= aggregationPeriod.two_hours then yes else no;
def h8 = high(period = aM8);
def l8 = low(period = aM8);
def c8 = close(period = aM8);
def o8 = open(period = aM8);

HAopen8 = CompoundValue(1, (HAopen8[1] + HAclose8[1]) / 2, (o8[1] + c8) / 2);
HAhigh8 = Max(h8, c8[1]);
HAlow8 = Min(l8, c8[1]);
HAclose8 = (HAopen8 + HAclose8[1] + HAlow8 + c8) / 4;
def HAMA8 = Average(HAclose8, length1);


def bullishM8 = c8 > HAMA8;
def bearishM8 = c8 < HAMA8;

AddLabel(showlabels and show2hour and m8a, "2HR", if bullishM8 then GlobalColor("Bullish") else
 if bearishM8 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# 4HR ################
def HAopen9;
def HAhigh9;
def HAlow9;
def HAclose9;
def aM9 = if currentTimeFrame <= aggregationPeriod.four_hours then aggregationPeriod.four_hours else currentTimeFrame;;
def M9A = if currentTimeFrame <= aggregationPeriod.four_hours then yes else no;
def h9 = high(period = aM9);
def l9 = low(period = aM9);
def c9 = close(period = aM9);
def o9 = open(period = aM9);

HAopen9 = CompoundValue(1, (HAopen9[1] + HAclose9[1]) / 2, (o9[1] + c9) / 2);
HAhigh9 = Max(h9, c9[1]);
HAlow9 = Min(l9, c9[1]);
HAclose9 = (HAopen9 + HAclose9[1] + HAlow9 + c9) / 4;
def HAMA9 = Average(HAclose9, length1);


def bullishM9 = c9 > HAMA9;
def bearishM9 = c9 < HAMA9;

AddLabel(showlabels and show4hour and m9a, "4HR", if bullishM9 then GlobalColor("Bullish") else
 if bearishM9 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# Daily ################
def HAopen10;
def HAhigh10;
def HAlow10;
def HAclose10;
def aM10 = if currentTimeFrame <= aggregationPeriod.Day then aggregationPeriod.Day else currentTimeFrame;;
def M10A = if currentTimeFrame <= aggregationPeriod.Day then yes else no;
def h10 = high(period = aM10);
def l10 = low(period = aM10);
def c10 = close(period = aM10);
def o10 = open(period = aM10);

HAopen10 = CompoundValue(1, (HAopen10[1] + HAclose10[1]) / 2, (o10[1] + c10) / 2);
HAhigh10 = Max(h10, c10[1]);
HAlow10 = Min(l10, c10[1]);
HAclose10 = (HAopen10 + HAclose10[1] + HAlow10 + c10) / 4;
def HAMA10 = Average(HAclose10, length1);


def bullishM10 = c10 > HAMA10;
def bearishM10 = c10 < HAMA10;


AddLabel(showlabels and show1day and m10a, "DAY", if bullishM10 then GlobalColor("Bullish") else
 if bearishM10 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));

################# Daily ################
def HAopen11;
def HAhigh11;
def HAlow11;
def HAclose11;
def aM11 = if currentTimeFrame <= aggregationPeriod.Three_Days then aggregationPeriod.Three_Days else currentTimeFrame;;
def M11A = if currentTimeFrame <= aggregationPeriod.Three_Days then yes else no;
def h11 = high(period = aM11);
def l11 = low(period = aM11);
def c11 = close(period = aM11);
def o11 = open(period = aM11);

HAopen11 = CompoundValue(1, (HAopen11[1] + HAclose11[1]) / 2, (o11[1] + c11) / 2);
HAhigh11 = Max(h11, c11[1]);
HAlow11 = Min(l11, c11[1]);
HAclose11 = (HAopen11 + HAclose11[1] + HAlow11 + c11) / 4;
def HAMA11 = Average(HAclose11, length1);




def bullishM11 = c11 > HAMA11;
def bearishM11 = c11 < HAMA11;


AddLabel(showlabels and show3day and m11a, "3DAY", if bullishM11 then GlobalColor("Bullish") else
 if bearishM11 then GlobalColor("Bearish")
 else GlobalColor("Neutral"));






Screenshot (196).png
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thread starter Similar threads Forum Replies Date
L MTF MA Cross Dashboard Questions 3
G MTF CCI Dashboard Questions 6
S MTF Shaded EMA Questions 4
T Repaints MTF EMA Scalper For ThinkOrSwim Questions 1
Freddie_CM MTF SMA Label Questions 3

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
553 Online
Create Post

Similar threads

Similar threads

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.
Back
Top