X-Axis Counting On Charts

YungTraderFromMontana

Well-known member
I'm still working on a improved version of fractal energy, does anybody know how to make time a usable variable? Let me explain.

lBQS2jG.png


(reference picture to understand) Lets say I wanted to count the number of hours the upper resistance(upper blue line) has been unbroken. So for each hour starting after the candle that the red arrow is on it would be +1 in value, if the resistance was still a resistance 10 hours later, then the variable would have a value of 10 and so on. Is this possible, I'm sure it is I just can't figure it out. Having time under resistance as a variable should be extremely valuable. Right now the fractal formula doesn't include time, but only the difference between the highs and lows of a certain period. @mashume @diazlaz @Welkin @BenTen
 
Oh hey @YungTraderFromMontana I have been gone for awhile but I made that overnight volume you requested in the group message. Anyway 1 way of counting the number of periods where the upper resistance remains unbroken would just be a counter or Recursion rec() line...
That might eat up a lot of resources but something like this?
Code:
def UnbrokenResistance = CompoundValue(1, if Price<Resistance then  UnbrokenResistance[1] + 1 else UnbrokenResistance[1], 0);

Something along this line should keep a running total... Do you want the count to reset after so long outside of resistance or anything like that
 

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

Thanks, the compound value function is what I was looking for. I was able to figure out the volume also. How can I get it to reset when resistance is broken?

I got it, I just added an else if statement.

@MattATM do you know any methods of converting the value of variables to constants so you can use them as lengths? That's the new issue I have

@MattATM Yo would you be up for a call? I need someone with good thinkscript knowledge to help me out so I can blow by roadblocks I'm having in my code. If you're up for it text me and we can get a time to call. It would be a big help.
 
Last edited by a moderator:
do you know any methods of converting the value of variables to constants so you can use them as lengths? That's the new issue I have
@YungTraderFromMontana it seems that Thinkscript doesn't support using variables as lengths when it is expecting constants... However, you might perhaps work around this by keeping a running total that resets itself when something happens...
Like what you want but turned inside out...
So instead of saying TimeLength=(hours spent above a resistance) and then using that Length to calculate something; you might keep a running total.
Code:
Is the hour above the resistance line Yes?/No? 
If Yes add the whatever happened this length to YoungTrader calculation... 
If No reset count or start other count...
 
I found a workaround. Can you see what I posted in the group earlier though, its really the last issue I need to solve before I have a finished product. It will be a length adapted Hurst exponent calculation designed specifically for breakouts.
 
You can reset the resistance values once something happens after each Break Out like if a certain relative volume is met or if the security creates a new Defended Price Line.
Oh I realized I am way behind cause I didn't touch the supports & resistances themselves. I just used them to count breakUP and BreakDOWN in our last email...

HpjBvg6.jpg


In the lower the blue counts the number of candles inside Support & Resistance once it has reset, The green counts Breakout UP the Red counts Breakout DOWN.

The Hurst Exponent looks beautiful and elegant... I wonder if it could be sped up with the defended price lines... Suppose if in PLUG a deliberate volume existed somewhere it forms a S&R but it could also mean those buyers want to take profits into the Breakout.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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