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
 

MatthewA

Active member
VIP
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
 

YungTraderFromMontana

Well-known member
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:

MatthewA

Active member
VIP
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...
 

YungTraderFromMontana

Well-known member
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.
 

RickAns

Active member
VIP

MatthewA

Active member
VIP
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.jpeg


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

Top