Label that keeps track of all the 4%+ up moves and -4%+ down moves of the day in an indices

DevBar

New member
I was looking for a script with an upper chart label that keeps a running total of all the 4% + up moves in green and 4% + down moves in red throughout the day in an indices. So SPX or/and Comp, if that can't be done then SPY works. If there is any issues with time constraints for the whole day with the coding then the opening would work. If this can be done that would be great, could it also work in premarket also?
Example
1. Track and display in green all the 4% + upward moves of SPX throughout the day
2. Track and display in red all the -4% + downward moves of SPX throughout the day
3. Display the 2 labels next to each other in the upper left corner of the SPX Chart
4. See if this can be used in premarket while looking at SPX chart

If this can be done amazing! If it has been done already, please forward that script me.
Thank you all!
 
Solution
I was looking for a script with an upper chart label that keeps a running total of all the 4% + up moves in green and 4% + down moves in red throughout the day in an indices. So SPX or/and Comp, if that can't be done then SPY works. If there is any issues with time constraints for the whole day with the coding then the opening would work. If this can be done that would be great, could it also work in premarket also?
Example
1. Track and display in green all the 4% + upward moves of SPX throughout the day
2. Track and display in red all the -4% + downward moves of SPX throughout the day
3. Display the 2 labels next to each other in the upper left corner of the SPX Chart
4. See if this can be used in premarket while looking at SPX...
I was looking for a script with an upper chart label that keeps a running total of all the 4% + up moves in green and 4% + down moves in red throughout the day in an indices. So SPX or/and Comp, if that can't be done then SPY works. If there is any issues with time constraints for the whole day with the coding then the opening would work. If this can be done that would be great, could it also work in premarket also?
Example
1. Track and display in green all the 4% + upward moves of SPX throughout the day
2. Track and display in red all the -4% + downward moves of SPX throughout the day
3. Display the 2 labels next to each other in the upper left corner of the SPX Chart
4. See if this can be used in premarket while looking at SPX chart

If this can be done amazing! If it has been done already, please forward that script me.
Thank you all!

This allows you to input the percent change you want. You can also test the code to see the candles colored meeting your conditions as well as the count below. The count is coded to reset each day.

The image has the test showing.

Capture.jpg
Ruby:
#1. Track and display in green all the 4% + upward moves of SPX throughout the day
#2. Track and display in red all the -4% + downward moves of SPX throughout the day
#3. Display the 2 labels next to each other in the upper left corner of the SPX Chart
#4. See if this can be used in premarket while looking at SPX chart

input percent     = 4;
input showlabel   = yes;

def hl   = high - low;
def diff = hl > hl[1] * (1 + percent / 100);
def up   = if GetDay() != GetDay()[1]
           then 0
           else if close > open and diff
           then up[1] + 1
           else up[1];
def dn   = if GetDay() != GetDay()[1]
           then 0
           else if close < open and diff
           then dn[1] + 1
           else dn[1];

AddLabel(showlabel, percent + "% Upward: " + up, Color.GREEN);
AddLabel(showlabel, percent + "% Downward: " + dn, Color.RED);

#####
input test        = no;
input candlecolor = yes;
AssignPriceColor(if test and candlecolor and close > open and diff then Color.WHITE else Color.CURRENT);
AssignPriceColor(if test and candlecolor and close < open and diff then Color.YELLOW else Color.CURRENT);
plot xup = if !test then Double.NaN else up;
xup.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
plot xdn = if !test then Double.NaN else dn;
xdn.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
 
Solution
I'll check this out to see how it works. I wanted to make sure my first post was clear enough just incase it was misunderstood when I was asking about the 4% moves in the SPX, I was looking at all the companies in the SPX with a 4% move up and down and keeping track of them throughout the day with the label. Was this interpreted correctly?
 

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
311 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