soru

Key_levels v0.1

516 8 67
Hello,
No description :)

have fun.

Cheers
Remove from Favorite Scripts Add to Favorite Scripts
study("Key_levels v0.1",overlay=true)
a=input(defval=1,title='R1/S1 - 0 for weekend analysis, 1 default')
aPTF = isweekly?'12M' : isdaily?'4M': interval==240 ? '3W' : interval==120 ? '1W' : interval == 60 ? '3D' : interval == 30 ? '3D' : interval==15 ? '2D' : interval==5 ? '1D' : interval==3 ? '960' : interval==1 ? '240' : '12M'
pivot = (high + low) / 2
use_fake_TF = input(false)
fake_TF = input('4M')
PTF = use_fake_TF ? fake_TF : aPTF


base(x,y) =>
    _pivot = security(tickerid, x, pivot[y])
    _high  = security(tickerid, x, high[y])
    q = 0.5 * (_high-_pivot)
    k = close > _pivot ? 1 : -1
    max_u = k > 0 ? (close-_pivot)/q+1 : na
    max_d = k < 0 ? (_pivot-close)/q+1 : na
    
    [_pivot, q,max_u,max_d]
    
[_pivot,q,max_u,max_d] = base(PTF,a)

plot(_pivot,style=circles, color=green)
plot(max_u > 0 ? _pivot+q*1:na,style=circles, color=blue)
plot(max_u > 1 ? _pivot+q*2:na,style=circles, color=green)
plot(max_u > 2 ? _pivot+q*3:na,style=circles, color=blue)
plot(max_u > 3 ? _pivot+q*4:na,style=circles, color=green)
plot(max_u > 4 ? _pivot+q*5:na,style=circles, color=blue)
plot(max_u > 5 ? _pivot+q*6:na,style=circles, color=green)
plot(max_u > 6 ? _pivot+q*7:na,style=circles, color=blue)
plot(max_u > 7 ? _pivot+q*8:na,style=circles, color=green)
plot(max_u > 8 ? _pivot+q*9:na,style=circles, color=blue)
plot(max_u > 9 ? _pivot+q*10:na,style=circles, color=green)

plot(max_d > 0 ? _pivot-q*1:na,style=circles, color=blue)
plot(max_d > 1 ? _pivot-q*2:na,style=circles, color=green)
plot(max_d > 2 ? _pivot-q*3:na,style=circles, color=blue)
plot(max_d > 3 ? _pivot-q*4:na,style=circles, color=green)
plot(max_d > 4 ? _pivot-q*5:na,style=circles, color=blue)
plot(max_d > 5 ? _pivot-q*6:na,style=circles, color=green)
plot(max_d > 6 ? _pivot-q*7:na,style=circles, color=blue)
plot(max_d > 7 ? _pivot-q*8:na,style=circles, color=green)
plot(max_d > 8 ? _pivot-q*9:na,style=circles, color=blue)
plot(max_d > 9 ? _pivot-q*10:na,style=circles, color=green)



TonyCampbell
a year ago
Can you explain about the inputs; such as fake TF. Any other explanation about the indicator itself would be appreciated..
Reply
soru TonyCampbell
a year ago
Hi Tony,
this indicator is a mix of pivot resistance/support levels with quarters theory.

The question is: Out of what timewindow pivot should be calculated to get reliable results - the anserw varies based on the TF and the instrument you are currently using. (I've found nice settings for EU 2h and daily charts - thats why I named it ver. 0.1).
Indicator default settings of timewindow can be overridden with fake TF option. You can input that period in minutes,days, weeks,months (ex. minutes "240", days: "2D" or weeks "1W" etc.) It also means that the pivot, and lvls are going to be updated every 'period'. For instance if you pick 120 minute as base period for pivot calculation (fake TF: 120) you can expect new S/R lvls every 120 minutes.
Current 'period' S/R levels are based on previous 'period' pivot level.

Sometimes I want to see what are new SR lvls thats why I added that 0,1 switch. Turning it to 0 means that S/R levels will be calculated based on current period so If your timewindow is for instance 1 week (fake TF: 1W) you can see new SR lvls over weekend - no need to wait for monday opening.

PS. Just to add - within one 'period' S/R lvls are in same distance one from another and indicator draws them only if the closure price is nearby



Reply
TonyCampbell soru
a year ago
Ok, excellent soru......thank you for your reply. Just to make sure I understand, if I have a 15 minute chart and use default input settings, the levels are calculated on the daily range of the prior day? If I enable FAKE TF to 2D, my 15 minute chart will display levels calculated on the range of the prior 2 days? Thanks again !
Reply
soru TonyCampbell
a year ago
by default on 15 min chart levels are calculated based on 2 days price action
Reply
TonyCampbell soru
a year ago
Ok, got it.....thanks soru for sharing your work and knowledge.....good trading to you....
Reply
soru
a year ago
np.
if you find good settings for other TFs on EU or other instruments you can share it here so that I can update defautl settings and re-share indicator.

Cheers
Reply
soru
a year ago
Admin - don't know why but my scripts thumbnails are scalled badly in the scripts listing :) others looks nice - can you look at it?

Thanks.
Reply
Kangaroo
a year ago
thx for this! gonna try it out
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out