Advanced_IndexLabel

woulf1004

Active member
VIP
Is there anyway possible to have this indicator
https://usethinkscript.com/threads/market-indicator.15785/
plot vertically on the right side of the expansion side of the chart?

script Sector {
input symb = "/CL";
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

input timeframe = AggregationPeriod.day;
input market = {"SPY", "VIX", "QQQ", "DIA", default "/CL"};
input showlabels = yes;

def CL = Sector("/CL");
def clPer = Round(CL, 4) * 100;
def CurrCL = +close("/CL", period = AggregationPeriod.DAY);
def ChangeCL = CurrCL - CurrCL[1];

AddLabel(showlabels, "CL: " + Round(ChangeCL) + " (" + clPer + "%" + ") ", if clPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.MAGENTA);

def SPX = Sector("SPX");
def spxPer = Round(SPX, 4) * 100;

def CurrSP = +close("SPX", period = AggregationPeriod.DAY);
def ChangeSP = CurrSP - CurrSP[1];

AddLabel(showlabels, "SPX: " + AsText(ChangeSP, NumberFormat.TWO_DECIMAL_PLACES) + " (" + spxPer + "%" + ") ", if spxPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def NDX = Sector("NDX");
def NDXPer = Round(NDX, 4) * 100;

def CurrNDX = +close("NDX", period = AggregationPeriod.DAY);
def ChangeNDX = CurrNDX - CurrNDX[1];

AddLabel(showlabels, "NDX: " + AsText(ChangeNDX, NumberFormat.TWO_DECIMAL_PLACES) + " (" + NDXPer + "%" + ") ", if NDXPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def DJI = Sector("$DJI");
def djiPer = Round(DJI, 4) * 100;

def CurrDJ = +close("$DJI", period = AggregationPeriod.DAY);
def ChangeDJ = CurrDJ - CurrDJ[1];

AddLabel(showlabels, "DJI: " + AsText(ChangeDJ, NumberFormat.TWO_DECIMAL_PLACES) + " (" + djiPer + "%" + ") ", if djiPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def COMP = Sector("COMP:GIDS");
def compPer = Round(COMP, 4) * 100;

def CurrC = +close("COMP:GIDS", period = AggregationPeriod.DAY);
def ChangeC = CurrC - CurrC[1];

AddLabel(showlabels, "COMP: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + compPer + "%" + ") ", if compPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def RUT = Sector("RUT");
def rutPer = Round(RUT, 4) * 100;

def CurrRU = +close("RUT", period = AggregationPeriod.DAY);
def ChangeRU = CurrRU - CurrRU[1];

addLabel(showlabels, "RUT: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + rutPer + "%" + ") ", if rutPer > 0 then COLOR.CYAN else color.GRAY);

AddLabel(showlabels, "||", Color.YELLOW);

AddLabel(showlabels, " ", Color.BLACK);
 

Attachments

  • Screenshot 2024-02-24 at 2.15.33 PM.png
    Screenshot 2024-02-24 at 2.15.33 PM.png
    217.2 KB · Views: 98
Last edited by a moderator:
Solution
@halcyonguy Did you have the chance to see the attached as a reference? I think what I’m asking shouldn’t be difficult to understand if you see the image created. Perhaps I need to attach it again. And this time I used a couple of red arrows to mark it. Oh, and please disregard all previous request since its been completely shifted to a different type of indicator which is only for label purposes.
All I need is to plot the label’s vertically on the right side of the expansion side of the chart as the sample provided in the attached.
Please use the script in the below.

script Sector {
input symb = "/CL";
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

input...
ToS does not allow the rotation of charts nor text/labels/bubbles.
A workaround would be to separate the script into 6 scripts, open a second chart grid, add the 6 new scripts to this second grid and then move 5 of the new scripts into 5 of the lower panes:

1708897391403.png


Note 1:
In your script you have "def COMP = Sector("COMP:GIDS");"
instead of the commonly used "($COMP:").
If this is intentional then disregard.

Note 2:
In your script you have "addLabel(showlabels, "RUT: " + AsText(ChangeC,... " (which is used directly above in the COMP script line).
I believe you intended to use ChangeRU.
If this is intentional then disregard.
 

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

Is there anyway possible to have this indicator
https://usethinkscript.com/threads/market-indicator.15785/
plot vertically on the right side of the expansion side of the chart?

script Sector {
input symb = "/CL";
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

input timeframe = AggregationPeriod.day;
input market = {"SPY", "VIX", "QQQ", "DIA", default "/CL"};
input showlabels = yes;

def CL = Sector("/CL");
def clPer = Round(CL, 4) * 100;
def CurrCL = +close("/CL", period = AggregationPeriod.DAY);
def ChangeCL = CurrCL - CurrCL[1];

AddLabel(showlabels, "CL: " + Round(ChangeCL) + " (" + clPer + "%" + ") ", if clPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.MAGENTA);

def SPX = Sector("SPX");
def spxPer = Round(SPX, 4) * 100;

def CurrSP = +close("SPX", period = AggregationPeriod.DAY);
def ChangeSP = CurrSP - CurrSP[1];

AddLabel(showlabels, "SPX: " + AsText(ChangeSP, NumberFormat.TWO_DECIMAL_PLACES) + " (" + spxPer + "%" + ") ", if spxPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def NDX = Sector("NDX");
def NDXPer = Round(NDX, 4) * 100;

def CurrNDX = +close("NDX", period = AggregationPeriod.DAY);
def ChangeNDX = CurrNDX - CurrNDX[1];

AddLabel(showlabels, "NDX: " + AsText(ChangeNDX, NumberFormat.TWO_DECIMAL_PLACES) + " (" + NDXPer + "%" + ") ", if NDXPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def DJI = Sector("$DJI");
def djiPer = Round(DJI, 4) * 100;

def CurrDJ = +close("$DJI", period = AggregationPeriod.DAY);
def ChangeDJ = CurrDJ - CurrDJ[1];

AddLabel(showlabels, "DJI: " + AsText(ChangeDJ, NumberFormat.TWO_DECIMAL_PLACES) + " (" + djiPer + "%" + ") ", if djiPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def COMP = Sector("COMP:GIDS");
def compPer = Round(COMP, 4) * 100;

def CurrC = +close("COMP:GIDS", period = AggregationPeriod.DAY);
def ChangeC = CurrC - CurrC[1];

AddLabel(showlabels, "COMP: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + compPer + "%" + ") ", if compPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def RUT = Sector("RUT");
def rutPer = Round(RUT, 4) * 100;

def CurrRU = +close("RUT", period = AggregationPeriod.DAY);
def ChangeRU = CurrRU - CurrRU[1];

addLabel(showlabels, "RUT: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + rutPer + "%" + ") ", if rutPer > 0 then COLOR.CYAN else color.GRAY);

AddLabel(showlabels, "||", Color.YELLOW);

AddLabel(showlabels, " ", Color.BLACK);

probably , but you will have to describe exactly what you want to see.
i have no idea what plot vertically means.
think about what you want to see on the chart,

where , chart
what , ?
when , after last bar

do you want 5 stacked line charts, 1 above the other ? so they don't overlap ?



side note,
i looked at that linked code and don't understand your question in that post either.
it has a lot of extra code that does nothing. (like this code)
it is just plotting the price difference between 2 bars, of diff stocks, of diff prices,... so it's of no use for comparing. should use a % change. maybe that what this code is trying to do?
if you want to plot more lines, it will need dozens more plot commands
 
@halcyonguy Did you have the chance to see the attached as a reference? I think what I’m asking shouldn’t be difficult to understand if you see the image created. Perhaps I need to attach it again. And this time I used a couple of red arrows to mark it. Oh, and please disregard all previous request since its been completely shifted to a different type of indicator which is only for label purposes.
All I need is to plot the label’s vertically on the right side of the expansion side of the chart as the sample provided in the attached.
Please use the script in the below.

script Sector {
input symb = "/CL";
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

input timeframe = AggregationPeriod.day;
input market = {"SPY", "VIX", "QQQ", "DIA", default "/CL"};
input showlabels = yes;

def CL = Sector("/CL");
def clPer = Round(CL, 4) * 100;
def CurrCL = +close("/CL", period = AggregationPeriod.DAY);
def ChangeCL = CurrCL - CurrCL[1];

AddLabel(showlabels, "CL: " + Round(ChangeCL) + " (" + clPer + "%" + ") ", if clPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.MAGENTA);

def SPX = Sector("SPX");
def spxPer = Round(SPX, 4) * 100;

def CurrSP = +close("SPX", period = AggregationPeriod.DAY);
def ChangeSP = CurrSP - CurrSP[1];

AddLabel(showlabels, "SPX: " + AsText(ChangeSP, NumberFormat.TWO_DECIMAL_PLACES) + " (" + spxPer + "%" + ") ", if spxPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def NDX = Sector("NDX");
def NDXPer = Round(NDX, 4) * 100;

def CurrNDX = +close("NDX", period = AggregationPeriod.DAY);
def ChangeNDX = CurrNDX - CurrNDX[1];

AddLabel(showlabels, "NDX: " + AsText(ChangeNDX, NumberFormat.TWO_DECIMAL_PLACES) + " (" + NDXPer + "%" + ") ", if NDXPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def DJI = Sector("$DJI");
def djiPer = Round(DJI, 4) * 100;

def CurrDJ = +close("$DJI", period = AggregationPeriod.DAY);
def ChangeDJ = CurrDJ - CurrDJ[1];

AddLabel(showlabels, "DJI: " + AsText(ChangeDJ, NumberFormat.TWO_DECIMAL_PLACES) + " (" + djiPer + "%" + ") ", if djiPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def COMP = Sector("COMP:GIDS");
def compPer = Round(COMP, 4) * 100;

def CurrC = +close("COMP:GIDS", period = AggregationPeriod.DAY);
def ChangeC = CurrC - CurrC[1];

AddLabel(showlabels, "COMP: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + compPer + "%" + ") ", if compPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def RUT = Sector("RUT");
def rutPer = Round(RUT, 4) * 100;

def CurrRU = +close("RUT", period = AggregationPeriod.DAY);
def ChangeRU = CurrRU - CurrRU[1];

addLabel(showlabels, "RUT: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + rutPer + "%" + ") ", if rutPer > 0 then COLOR.CYAN else color.GRAY);

AddLabel(showlabels, "||", Color.YELLOW);

AddLabel(showlabels, " ", Color.BLACK);
 

Attachments

  • IMG_0484.jpeg
    IMG_0484.jpeg
    471.4 KB · Views: 64
Last edited:
@halcyonguy Did you have the chance to see the attached as a reference? I think what I’m asking shouldn’t be difficult to understand if you see the image created. Perhaps I need to attach it again. And this time I used a couple of red arrows to mark it. Oh, and please disregard all previous request since its been completely shifted to a different type of indicator which is only for label purposes.
All I need is to plot the label’s vertically on the right side of the expansion side of the chart as the sample provided in the attached.
Please use the script in the below.

script Sector {
input symb = "/CL";
def c = close(symbol = symb, period = AggregationPeriod.DAY);
def PctChg = (c / c[1]) - 1;
plot pct = PctChg;
}

input timeframe = AggregationPeriod.day;
input market = {"SPY", "VIX", "QQQ", "DIA", default "/CL"};
input showlabels = yes;

def CL = Sector("/CL");
def clPer = Round(CL, 4) * 100;
def CurrCL = +close("/CL", period = AggregationPeriod.DAY);
def ChangeCL = CurrCL - CurrCL[1];

AddLabel(showlabels, "CL: " + Round(ChangeCL) + " (" + clPer + "%" + ") ", if clPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.MAGENTA);

def SPX = Sector("SPX");
def spxPer = Round(SPX, 4) * 100;

def CurrSP = +close("SPX", period = AggregationPeriod.DAY);
def ChangeSP = CurrSP - CurrSP[1];

AddLabel(showlabels, "SPX: " + AsText(ChangeSP, NumberFormat.TWO_DECIMAL_PLACES) + " (" + spxPer + "%" + ") ", if spxPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def NDX = Sector("NDX");
def NDXPer = Round(NDX, 4) * 100;

def CurrNDX = +close("NDX", period = AggregationPeriod.DAY);
def ChangeNDX = CurrNDX - CurrNDX[1];

AddLabel(showlabels, "NDX: " + AsText(ChangeNDX, NumberFormat.TWO_DECIMAL_PLACES) + " (" + NDXPer + "%" + ") ", if NDXPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def DJI = Sector("$DJI");
def djiPer = Round(DJI, 4) * 100;

def CurrDJ = +close("$DJI", period = AggregationPeriod.DAY);
def ChangeDJ = CurrDJ - CurrDJ[1];

AddLabel(showlabels, "DJI: " + AsText(ChangeDJ, NumberFormat.TWO_DECIMAL_PLACES) + " (" + djiPer + "%" + ") ", if djiPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def COMP = Sector("COMP:GIDS");
def compPer = Round(COMP, 4) * 100;

def CurrC = +close("COMP:GIDS", period = AggregationPeriod.DAY);
def ChangeC = CurrC - CurrC[1];

AddLabel(showlabels, "COMP: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + compPer + "%" + ") ", if compPer > 0 then Color.CYAN else Color.GRAY);

AddLabel(showlabels, ":", Color.YELLOW);

def RUT = Sector("RUT");
def rutPer = Round(RUT, 4) * 100;

def CurrRU = +close("RUT", period = AggregationPeriod.DAY);
def ChangeRU = CurrRU - CurrRU[1];

addLabel(showlabels, "RUT: " + AsText(ChangeC, NumberFormat.TWO_DECIMAL_PLACES) + " (" + rutPer + "%" + ") ", if rutPer > 0 then COLOR.CYAN else color.GRAY);

AddLabel(showlabels, "||", Color.YELLOW);

AddLabel(showlabels, " ", Color.BLACK);

ah i see now. sorry, my browser has been acting strange today. i couldn't open the pic earlier.

no , can't draw labels sideways
you can place bubbles anywhere , with multiple lines of text. if all the bubbles use the same price number, they will be stacked
 
Solution
ah i see now. sorry, my browser has been acting strange today. i couldn't open the pic earlier.

no , can't draw labels sideways
you can place bubbles anywhere , with multiple lines of text. if all the bubbles use the same price number, they will be stacked
No worries. And thanks for the quick follow up.
By the way, is it possible to use the value of each market (SPX, NDX, DJI, COMP and RUT) based on the script provided to create and plot an average line that has a pivot point horizontal line in addition to a sma line?
And please let me know if additional reference is needed.

Any updates please?

Not sure if my question and request was not clear but let me try this again.
Can this script be utilized to create an indicator that plots a single average line based on each individual market value (SPX, NDX, and DJI)? Please advise.
 
Last edited by a moderator:
Thread starter Similar threads Forum Replies Date
W Advanced TRIX Questions 3
W Advanced VWAP Questions 8
W Advanced Pivot Point Indicator Questions 6
W Advanced EMAD Modification Request Questions 5
C Advanced Trader Pro Questions 32

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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