Volatility Support Resistance Indicator

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #58619 quote
    Ivan Donatiello
    Participant
    Average

    Hello everyone here Ivan Donatiello,

    I am studying Kirk Northington’s book “Volatility-Based Technical Analysis: Strategies for Trading the Invisible” 2009 USA.

    I am intrigued about an indicator called N Bande, but the code is the owner of MetaStock.

    However I created a variant that gives me good triggers using the Bollinger Bands. The indicator I want to create must do the following.

    1. Create a horizontal line when today’s Bollinger + is lower than yesterday’s bolligenger +.
    2. Create 3 liene that have the value of the 10-period ATR, subtracting from the value of point 1.

    The exact opposite for Bollinger -.

    Each time a new condition is created, as in point 1, the line must be updated, while keeping the old values on the graph history. It should appear a broken leena the most important values are the most recent.

    Below is an image to start with.

    Thank you all

    SR-Band-Indicator.png SR-Band-Indicator.png
    #58622 quote
    Nicolas
    Keymaster
    Master

    Remind me these topics:

    https://www.prorealcode.com/topic/newbie-coding-request-bb-sr/

    https://www.prorealcode.com/topic/bands-n-metastock/

    Your version/interpretation of this indicator is easier to code.

    So, each time the condition 1 is met, we update the whole lines calculation? right?

    #58627 quote
    Ivan Donatiello
    Participant
    Average

    Yes Nicolas, whenever the condition occurs 1, we update the R1. The same thing for the S1 for the Bolloger –

    Study the topics that you have link to me 🙂

    #58634 quote
    Nicolas
    Keymaster
    Master

    Ok, so this is the indicator that plot the upper and lower bollinger bands as support/resistance lines when they quit the expansion phase (phase 2). Other lines are calculated with an ATR 10 periods. Sometimes lines are overlapping and it is a bit confusing IMO.

    //https://www.prorealcode.com/topic/volatility-support-resistance-indicator/
    //Nicolas @ prorealcode.com
    upper = BollingerUp[20](close)
    lower = BollingerDown[20](close)
    atr = averagetruerange[10]
    
    if upper<upper[1] and upper[1]>upper[2] then 
    r1 = upper
    rr2 = upper - atr
    r3 = upper - 2*atr
    r4 = upper - 3*atr 
    endif
    
    if lower>lower[1] and lower[1]<lower[2] then
    s1 = lower
    s2 = lower + atr
    s3 = lower + 2*atr
    s4 = lower + 3*atr
    endif
    
    return r1 coloured(200,200,0) style(line,2) as "r1", rr2 coloured(100,100,100) style(dottedline,1) as "r2", r3 coloured(100,100,100) style(dottedline,1) as "r3", r4 coloured(100,100,100) style(dottedline,1) as "r4", s1 coloured(200,200,0) style(line,2) as "s1", s2 coloured(100,100,100) style(dottedline,1) as "s2", s3 coloured(100,100,100) style(dottedline,1) as "s3", s4 coloured(100,100,100) style(dottedline,1) as "s4"
    support-resistance-lines-with-bollinger-bands.png support-resistance-lines-with-bollinger-bands.png
    #58688 quote
    Ivan Donatiello
    Participant
    Average

    Thanks Nicolas 🙂

    Then the indicator worked well but it gave a delay period. In addition, the Bollinger caused the price to go out of the volatility bands too often, so I tried using bands built by linear regression. It seems that they work well. Below are the two codes and the screeshot.

    Bands of volatility equal to the bollinger but with the measure of central tendency linear regression:

    //https://www.prorealcode.com/topic/volatility-support-resistance-indicator/
    //Ivan @ prorealcode.com
    
    period=10
    
     
    x1=LinearRegression[period](close)
    x2=2.5*STD[20](close)
     
    h1=x1+x2
    h2=x1-x2
    
    return h1,h2, x1

    Indicator of Nicolas with the correction of the delay period:

    //https://www.prorealcode.com/topic/volatility-support-resistance-indicator/
    //Nicolas @ prorealcode.com
    
    
    
    upper = LinearRegression[10](close)+2.5*std[20](close)
    lower = LinearRegression[10](close)-2.5*std[20](close)
    atr = averagetruerange[40]
    
    if upper<upper[1] and upper[1]>upper[2] then
    r1 = upper[1]
    rr2 = upper[1] - atr
    r3 = upper[1] - 2*atr
    r4 = upper[1] - 3*atr
    endif
    
    if lower>lower[1] and lower[1]<lower[2] then
    s1 = lower[1]
    s2 = lower[1] + atr
    s3 = lower[1] + 2*atr
    s4 = lower[1] + 3*atr
    endif
    
    return r1 coloured(200,200,0) style(line,2) as "r1", rr2 coloured(100,100,100) style(dottedline,1) as "r2", r3 coloured(100,100,100) style(dottedline,1) as "r3", r4 coloured(100,100,100) style(dottedline,1) as "r4", s1 coloured(200,200,0) style(line,2) as "s1", s2 coloured(100,100,100) style(dottedline,1) as "s2", s3 coloured(100,100,100) style(dottedline,1) as "s3", s4 coloured(100,100,100) style(dottedline,1) as "s4"

    It would be nice to combine in a single indicator, but even so it’s more than good 🙂

    Below is the screenshot. Note I put the invisible central blind.

    Thanks Nicolas  🙂

    volatility-Support-Resistance-Indicator.png volatility-Support-Resistance-Indicator.png
    #58702 quote
    Nicolas
    Keymaster
    Master

    Change the last line of your indicator by this one and you’ll have an “all-in-one” indi.

    return r1 coloured(200,200,0) style(line,2) as "r1", rr2 coloured(100,100,100) style(dottedline,1) as "r2", r3 coloured(100,100,100) style(dottedline,1) as "r3", r4 coloured(100,100,100) style(dottedline,1) as "r4", s1 coloured(200,200,0) style(line,2) as "s1", s2 coloured(100,100,100) style(dottedline,1) as "s2", s3 coloured(100,100,100) style(dottedline,1) as "s3", s4 coloured(100,100,100) style(dottedline,1) as "s4", upper, lower
    #58718 quote
    Billy Ray Valentine
    Participant
    Senior

    Non ho capito come fare ad unire i due indicatori, potete riscriverlo voi il codice finale?

    #58747 quote
    Ivan Donatiello
    Participant
    Average

    This is my final version. I made some changes because I saw that volatility changes affect both the compressions and the expansions.

    So the inidator treats supports and resistance on the expansion returns, in the same way supports and resistance on the beginning of volatility expansion.

    It would be nice to be able to put the names to the supports and resistors, example above or to finaco to the line S1, S2, R1, R2 etc. but I do not know how to do it 🙂

    //https://www.prorealcode.com/topic/volatility-support-resistance-indicator/
    //Nicolas @ prorealcode.com
    
    upper = LinearRegression[10](close)+2.5*std[20](close)
    lower = LinearRegression[10](close)-2.5*std[20](close)
    atr = averagetruerange[40]
    
    if upper<upper[1] and upper[1]>upper[2] then
    r1 = upper[1]
    rr2 = upper[1] - atr
    
    endif
    
    if lower>lower[1] and lower[1]<lower[2] then
    s1 = lower[1]
    s2 = lower[1] + atr
    
    endif
    
    if upper>upper[1] and upper[1]<upper[2] then
    r3 = upper[1]
    r4 = upper[1] - atr
    
    endif
    
    if lower<lower[1] and lower[1]>lower[2] then
    s3 = lower[1]
    s4 = lower[1] + atr
    
    endif
    
    period=10
     
     
    x1=LinearRegression[period](close)
    x2=2.5*STD[20](close)
     
    h1=x1+x2
    h2=x1-x2
     
    
    
    
    return r1 coloured(100,100,0) style(dottedline,1) as "r1", rr2 coloured(100,100,0) style(dottedline,1) as "r2",  s1 coloured(100,100,0) style(dottedline,1) as "s1", s2 coloured(100,100,0) style(dottedline,1) as "s2", r3 coloured(100,100,100) style(dottedline,1) as "r3", r4 coloured(100,100,100) style(dottedline,1) as "r4",  s3 coloured(100,100,100) style(dottedline,1) as "s3", s4 coloured(100,100,100) style(dottedline,1) as "s4", h1 coloured(255,140,0) style(line,2) as "h1", h2 coloured(255,140,0) style(line,2) as "h2", x1
    NASDAQ-Giornaliero.png NASDAQ-Giornaliero.png
    #58759 quote
    Sofitech
    Participant
    Master

    Could you give some explanation about how this indicator is used ? Is he part of a trading method described in the book ?

    #58761 quote
    robertogozzi
    Moderator
    Master

    Non ho capito come fare ad unire i due indicatori, potete riscriverlo voi il codice finale?

    Nel forum in lingua Inglese si prega di usare l’inglese. Grazie.

    Billy Ray Valentine thanked this post
    #58787 quote
    Ivan Donatiello
    Participant
    Average

    A question, sorry for the in-experience. But if we program an indicator that is similar to an owner, as in this case, is it a violation of copyright?

    Otherwise, delete everything immediately!

    #58956 quote
    Nicolas
    Keymaster
    Master

    We are absolutely not violating copyright here, and as I said your code is not near to the original version. If we can’t plot lines on a chart based on standard deviation from a mean, because someone already did it in a book, well .. a lot of codes around here should de deleted also 🙂

    #59090 quote
    Leo
    Participant
    Veteran

    Ivan, can you explain the strategy then. Thanks

    #59316 quote
    Ivan Donatiello
    Participant
    Average

    The strategy is based on the mathematics of volatility. One method that you find in the book of the post above, is 500 pages of stuff difficult to answer so quickly.

    #90523 quote
    Jordan Belgrave
    Participant
    New

    anybody knows why Trading View does not accept this script ?

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.

Volatility Support Resistance Indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 16 replies,
has 7 voices, and was last updated by robertogozzi
7 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/09/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...