Logarithm Garman-Klass Volatility Estimator

Logarithm Garman-Klass Volatility Estimator

 

WHAT IS THIS?

This is my personal port of the Logarithmic Garman-Klass as openly found at  iVolatility.com.

This estimator tends to be as fast as the RiskMetrics EWMA but without the noisy overshooting and will not lag as other estimators based on pure arithmetic Standard Deviation like Close-To-Close HV, Original Garman-Klass, Parkinson’s, Rogers-Satchell’s, Yang-Zhang, etc.

Cheers, and any contributions will be welcome.

THE CODE:

DISCLAIMER:   The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets. 

The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is by Creative-Commons and in regard of ProRealCode regulations.   Any use, copy or re-use of this code should mention it’s origin as it’s authorship.

XeL 2017

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. xel • 09/12/2017 #

    Hi! I found myself that the indicator posted here contain an error, I want to edit or fix it as it is not drawing well. [ CC @nicolas ]

    The correct algorithm in code should be this:

    Lookback = 30
    Compound = 252
    ///////////////////
    // LOGARITHM GARMAN-KLASS VOLATILITY ESTIMATOR by @Xel_arjona
    // Ported to ProRealCode as Formulae openly described in http://www.ivolatility.com/help/7.html
    lnCC = log(close/close[1])
    lnCO = log(close/open)
    lnOC = log(open/close[1])
    lnHL = log(high/low)
    // Lambda definition:
    lambda = Lookback/(Lookback+3)
    //Initialization with Close-To-Close Historical Volatility
    varCC = summation[Lookback](square(lnCC)) / Lookback
    //Logarithmic Garman-Klass Realized/Historical Estimate as in iVolatility.com
    if barindex < Lookback+4 then
    varLGK = varCC
    else
    GK = square(lnOC) + 0.5*square(lnHL) - 0.386*square(lnCO)
    LGK = log(varCC)
    LGK = ((1-lambda)*log(GK[1])) + (lambda*log(LGK[1]))
    varLGK = exp( LGK )
    endif
    LGKest = sqrt(varLGK)*sqrt(Compound) * 100
    // PLOT DIRECTIVE
    RETURN LGKest as "LGK"

    The correction is on the Autoregresive definition for LGK, which should be refered to last value “LGK[1]” instead of current. Even this patch is applyed; the code itself do not print correct values (giving only zeros), but this is a possible limitation on PRT or a missundestood of mine for the internals of ProRealCode. This same kind of algorithm do some errors for other indicators of mine also. https://www.prorealcode.com/topic/plot-issue-with-custom-exponential-indicator/

    Cheers and sorry for the inconvenience.

avatar
Register or

Likes

avatar avatar avatar avatar avatar
Related users ' posts
jacquesgermain à utiliser en unité de temps jour
kats BONSOIR c bon merci j ai trouve ce weekend merci de votre reponse cdlt
the_giorgio Hi, nice work I would like to understand something about prorealtime code. With your ...
Iván Hello. When you use the drawcandle() instruction then in the configuration window you add ...
jacquesgermain sì da aggiungere
Maik2404 auf welchen Wert muss ich die Kompresionsperiode stellen?
jacquesgermain — Période de compression : ce paramètre détermine la période de rétrospection utilisée pour ...
AndPar Buongiorno Nicolas, vorrei provare questo indicatore, ma quando lo inserisco in PRT mi vengo...
Nicolas Basta aggiungerlo al prezzo https://www.prorealcode.com/blog/video-tutorials/how-to-add-an-i...
Aragorna hello Nicolas, this indicator works with the last Beta version of PRT? Ive seen tha many in...
SnorreDK Works extremely well - How? How do u implement this in a startegy? Breakoutstrategy?
Keyeming Thanks, but yes same question as above, some explanations on how to read it would be appreci...
Bateson Bonjour. Merci beaucoup ! J'ai installé l'indicateur sur PRT 11 mais pour des raisons qui ...
CederTrader Hi Denis, does this indicator add to the chart as panel, or on the candles. Thanks
Nicolas Add it on the price chart as described in this video: https://www.prorealcode.com/blog/video...
Denis Hello Nicolas and Ceder Trader, Sorry, I only just saw your replies. The indicator is alre...
Seabiscuit Hi! I like this indicator a lot, been using it on a 30 min timeframe and usually confirms my...
Ramahu Bonjour et merci pour cet indicateur ! je l'observe sur les actions du Nasdaq et la plupart ...
Nicolas Il doit s'agir d'un mauvais copier/coller. Je suggère de télécharger le fichier itf contenu ...
Bard Hello @Nicolas, I can get this to display in a separate indicator panel but not on Price as ...
Stenozar Hi @Nicolas, how can I put the bands on price? Thanks, Stefano
Fabian Hi IV Mcm, have you drawn the rectangles (Dinamic, Range) by yourself in the chart or are...
IV Mcm Myself to illustrate ;)
oraclus Bonjour indicateur très intéressant existe t il un screener qui détecte les actions qui donn...
IV Mcm Ce n'est pas le but de cet indicateur, mais avec un peu d'entraînement vous pourriez le code...
Yantra Thank you for sharing your good work!
luxrun sorry, add prt code add doesn't work
robertogozzi Don't worry about PRT code, I can't make it work either! Great for pointing that out, it's ...
Khaled @Luxrun, good morning, you mentionned "y = exponentialaverage (x)", isn't the period of the ...
luxrun One question, Roberto: the two AvgT are variable, could you explain to me what they regulate...
robertogozzi AvgT stands for Average Type, it's a parameter for the AVERAGE keyword (https://www.prorealc...
robertogozzi Yes, you can use any setting that suits you best! As to which one... it depends on the inst...
DaxRider grazie Robnerto
Nicolas remplacer les valeurs de coloured(0,255,0) par coloured(r,g,b) et ajouter ces noms de variab...
mohamed merci Nicolas!
sacram14 Merci Nicolas pour ce set-up que je ne connaissais pas ! J'ai tenté de reprendre le code pou...
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.
Bard Very interesting approach Vonasi! I'm getting a 404 error when trying to download though?
Vonasi I just tested and I was able to download with no error.
Psari Hi Vonasi, I am a newbie and was wondering whether you could possibly help me with this pro...
Bard I've also just noticed that changing the "Bands Deviation" setting from 1.25 to eg 3 doesn't...
bartekz Hi @Nicolas, Really impressed by your work. I am trying to replicate the Wave-PM indicator t...
Nicolas You don't have to replicate it, download the file and import it into your platform.

Top