Major Indices MOMO Labels

adlane

New member
Just want to find out why I can not do this simple program which monitors what each bar is doing in the big 4 Stock Index Futures at any one time, i.e. /ES,/YM,/NQ,/RTY in the 1m Bar by creating a little AddLabel that by its # let me know what each are doing while I am on just One Chart. How would a trained programmer in ToS do it?

Here is the Study that does not work. If there is a beginner place I need to post, let me know that.
Code:
#ADLIndGrade1mGreenAddLabelStudy--- Does not Work on 1m or 1m- Does not work!

declare upper;

# 1m Bar in Formation across all 4 Indices
# Green
def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES, AggregationPeriod.Five_Min ")[0];
def Green1mYM = close("/YM", AggregationPeriod.MIN)[0] >= open("/YM, AggregationPeriod.Five_Min ")[0];
def Green1mNQ = close("/NQ", AggregationPeriod.MIN)[0] >= open("/NQ, AggregationPeriod.Five_Min ")[0];
def Green1mRTY = close("/RTY", AggregationPeriod.MIN)[0] >= open("/RTY, AggregationPeriod.Five_Min ")[0];

############### AddLabel Assignments per Each Permutation of 4 ##############
AddLabel(Green1mES && Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= "+8, GetColor(5));

#######
AddLabel(Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
######

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
######-2

#######
AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
#####0

AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= "+0, GetColor(5));
 
Last edited by a moderator:
  • Love
Reactions: IPA
Solution
Just want to find out why I can not do this simple program which monitors what each bar is doing in the big 4 Stock Index Futures at any one time, i.e. /ES,/YM,/NQ,/RTY in the 1m Bar by creating a little AddLabel that by its # let me know what each are doing while I am on just One Chart. How would a trained programmer in ToS do it?

Here is the Study that does not work. If there is a beginner place I need to post, let me know that.
Code:
#ADLIndGrade1mGreenAddLabelStudy--- Does not Work on 1m or 1m- Does not work!

declare upper;

# 1m Bar in Formation across all 4 Indices
# Green
def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES, AggregationPeriod.Five_Min ")[0];
def Green1mYM = close("/YM"...
Just want to find out why I can not do this simple program which monitors what each bar is doing in the big 4 Stock Index Futures at any one time, i.e. /ES,/YM,/NQ,/RTY in the 1m Bar by creating a little AddLabel that by its # let me know what each are doing while I am on just One Chart. How would a trained programmer in ToS do it?

Here is the Study that does not work. If there is a beginner place I need to post, let me know that.
Code:
#ADLIndGrade1mGreenAddLabelStudy--- Does not Work on 1m or 1m- Does not work!

declare upper;

# 1m Bar in Formation across all 4 Indices
# Green
def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES, AggregationPeriod.Five_Min ")[0];
def Green1mYM = close("/YM", AggregationPeriod.MIN)[0] >= open("/YM, AggregationPeriod.Five_Min ")[0];
def Green1mNQ = close("/NQ", AggregationPeriod.MIN)[0] >= open("/NQ, AggregationPeriod.Five_Min ")[0];
def Green1mRTY = close("/RTY", AggregationPeriod.MIN)[0] >= open("/RTY, AggregationPeriod.Five_Min ")[0];

############### AddLabel Assignments per Each Permutation of 4 ##############
AddLabel(Green1mES && Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= "+8, GetColor(5));

#######
AddLabel(Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
######

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
######-2

#######
AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
#####0

AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= "+0, GetColor(5));
Issue #1:
Lines 7-10: Quotes are misplaced, should be around "symbols"

def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES", AggregationPeriod.Five_Min)[0];
def Green1mYM = close("/YM", AggregationPeriod.MIN)[0] >= open("/YM", AggregationPeriod.Five_Min)[0];
def Green1mNQ = close("/NQ", AggregationPeriod.MIN)[0] >= open("/NQ", AggregationPeriod.Five_Min)[0];
def Green1mRTY = close("/RTY", AggregationPeriod.MIN)[0] >= open("/RTY", AggregationPeriod.Five_Min)[0];

After correcting that issue will lead you to read the error (click on the ! in the upper left of the chart):

1709826084491.png


Revise your script as stated in the image.
 
Just want to find out why I can not do this simple program which monitors what each bar is doing in the big 4 Stock Index Futures at any one time, i.e. /ES,/YM,/NQ,/RTY in the 1m Bar by creating a little AddLabel that by its # let me know what each are doing while I am on just One Chart. How would a trained programmer in ToS do it?

Here is the Study that does not work. If there is a beginner place I need to post, let me know that.
Code:
#ADLIndGrade1mGreenAddLabelStudy--- Does not Work on 1m or 1m- Does not work!

declare upper;

# 1m Bar in Formation across all 4 Indices
# Green
def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES, AggregationPeriod.Five_Min ")[0];
def Green1mYM = close("/YM", AggregationPeriod.MIN)[0] >= open("/YM, AggregationPeriod.Five_Min ")[0];
def Green1mNQ = close("/NQ", AggregationPeriod.MIN)[0] >= open("/NQ, AggregationPeriod.Five_Min ")[0];
def Green1mRTY = close("/RTY", AggregationPeriod.MIN)[0] >= open("/RTY, AggregationPeriod.Five_Min ")[0];

############### AddLabel Assignments per Each Permutation of 4 ##############
AddLabel(Green1mES && Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= "+8, GetColor(5));

#######
AddLabel(Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
######

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
######-2

#######
AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
#####0

AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= "+0, GetColor(5));


carl pointed out the symbol typo, but misdiagnosed the other problem.
chart time has to be set to the smallest aggregation time specified in the study, 1 minute. if you do that, then you get a different error.

can't specify 2 different aggregation times in a formula
n4tKX08.png


def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES", AggregationPeriod.Five_Min)[0];

have to define the aggregations in separate variables.
then use the variables in a formula
def a = close("/ES", AggregationPeriod.MIN);
def b = open("/ES", AggregationPeriod.Five_Min);
def Green1mES = a >= b;


there is no point in using a 2nd aggregation of 1 min, as it is the smallest.
just set the chart to 1 minute and use close("/ES");



Code:
#agg_futures_compare

#https://usethinkscript.com/threads/simple-beginner-program-what-is-the-problem-w-study.18043/
#Simple Beginner Program- What is the Problem w/ Study?
#adlane  3/7

#Just want to find out why I can not do this simple program which monitors what each bar is doing in the big 4 Stock Index Futures at any one time, i.e. /ES,/YM,/NQ,/RTY in the 1m Bar by creating a little AddLabel that by its # let me know what each are doing while I am on just One Chart. How would a trained programmer in ToS do it?

#Here is the Study that does not work. If there is a beginner place I need to post, let me know that.


#ADLIndGrade1mGreenAddLabelStudy--- Does not Work on 1m or 1m- Does not work!

declare upper;

# 1m Bar in Formation across all 4 Indices
# Green
#def Green1mES = close("/ES", AggregationPeriod.MIN)[0] >= open("/ES", AggregationPeriod.Five_Min)[0];
#def Green1mYM = close("/YM", AggregationPeriod.MIN)[0] >= open("/YM", AggregationPeriod.Five_Min)[0];
#def Green1mNQ = close("/NQ", AggregationPeriod.MIN)[0] >= open("/NQ", AggregationPeriod.Five_Min)[0];
#def Green1mRTY = close("/RTY", AggregationPeriod.MIN)[0] >= open("/RTY", AggregationPeriod.Five_Min)[0];

def es1 = close("/ES");
def es5 = open("/ES", AggregationPeriod.Five_Min);
def ym1 = close("/YM");
def ym5 = open("/YM", AggregationPeriod.Five_Min)[0];
def nq1 = close("/NQ");
def nq5 = open("/NQ", AggregationPeriod.Five_Min)[0];
def rty1 = close("/RTY");
def rty5 = open("/RTY", AggregationPeriod.Five_Min)[0];


def Green1mES = es1 >= es5;
def Green1mYM = ym1 >= ym5;
def Green1mNQ = nq1 >= nq5;
def Green1mRTY = rty1 >= rty5;


input test_labels = yes;
addlabel(1, " ", color.black);
addlabel(test_labels, "/ES", (if Green1mES then color.green else color.gray));
addlabel(test_labels, "/YM", (if Green1mYM then color.green else color.gray));
addlabel(test_labels, "/NQ", (if Green1mNQ then color.green else color.gray));
addlabel(test_labels, "/RTY", (if Green1mRTY then color.green else color.gray));
addlabel(1, " ", color.black);


############### AddLabel Assignments per Each Permutation of 4 ##############
AddLabel(Green1mES && Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= "+8, GetColor(5));

#######
AddLabel(Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
AddLabel(Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
AddLabel(Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 6, GetColor(5));
######

AddLabel(!Green1mES && !Green1mYM && Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(!Green1mES && Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
AddLabel(Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 4, GetColor(5));
######-2

#######
AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && !Green1mYM && Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(!Green1mES && Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
AddLabel(Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= " + 2, GetColor(5));
#####0

AddLabel(!Green1mES && !Green1mYM && !Green1mNQ && !Green1mRTY, "IndicesGrade= "+0, GetColor(5));

NlXQJG2.jpeg
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
386 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