Andean Oscilator conversion
Forums › ProRealTime forum Français › Support ProBuilder › Andean Oscilator conversion
- This topic has 2 replies, 3 voices, and was last updated 2 years ago by
Nicolas.
-
-
08/19/2022 at 2:04 PM #199240
Bonjour Nicolas, Bonjour à tous.
J’ai découvert il y a quelques semaines un oscillateur que je trouve simple et utile sur tradingview. Le code ne semble pas compliqué mais je suis bien incapable de le convertir en language PRT.
Peut-être que l’équivalent ou presque existe déjà.
Est-ce que quelqu’un serait en mesure de convertir ce code. Je fais figurer une image pour l’illustrer. La ligne verte peut être interprétée comme une force acheteuse, la rouge une force vendeuse, la jaune une ligne “signal”1234567891011121314151617181920212223242526272829303132333435363738394041424344454647// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/// © alexgrover//Original post : Alpaca.markets/learn/andean-oscillator-a-new-technical-indicator-based-on-an-online-algorithm-for-trend-analysis///@version=5indicator("Andean Oscillator")//------------------------------------------------------------------------------//Settings//-----------------------------------------------------------------------------{length = input(50)sig_length = input(9,'Signal Length')//-----------------------------------------------------------------------------}//Exponential Envelopes//-----------------------------------------------------------------------------{var alpha = 2/(length+1)var up1 = 0.,var up2 = 0.var dn1 = 0.,var dn2 = 0.C = closeO = openup1 := nz(math.max(C, O, up1[1] - (up1[1] - C) * alpha), C)up2 := nz(math.max(C * C, O * O, up2[1] - (up2[1] - C * C) * alpha), C * C)dn1 := nz(math.min(C, O, dn1[1] + (C - dn1[1]) * alpha), C)dn2 := nz(math.min(C * C, O * O, dn2[1] + (C * C - dn2[1]) * alpha), C * C)//Componentsbull = math.sqrt(dn2 - dn1 * dn1)bear = math.sqrt(up2 - up1 * up1)signal = ta.ema(math.max(bull, bear), sig_length)//-----------------------------------------------------------------------------}//Plots//-----------------------------------------------------------------------------{plot(bull, 'Bullish Component', #089981)plot(bear, 'Bearish Component', #f23645)plot(signal, 'Signal', #ff9800)//-----------------------------------------------------------------------------}08/19/2022 at 2:59 PM #199247Bonjour, tentative de conversion à tester, en attendant que Nicolas, bien plus habitué à faire les conversions, passe par ce post et valide ou corrige:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/// © alexgrover//Original post : Alpaca.markets/learn/andean-oscillator-a-new-technical-indicator-based-on-an-online-algorithm-for-trend-analysis///@version=5//indicator("Andean Oscillator")// Converted from pinescript for ProRealTime// 19.08.2022// JC_Bywan @ www.ProRealCode.com// Sharing ProRealTime knowledge//------------------------------------------------------------------------------//Settings//-----------------------------------------------------------------------------{length=50siglength = 9//-----------------------------------------------------------------------------}//Exponential Envelopes//-----------------------------------------------------------------------------{alpha = 2/(length+1)//up1 = 0//up2 = 0//dn1 = 0//dn2 = 0C = closeO = openif barindex=0 thenup1 = Cup2 = C * Cdn1 = Cdn2 = C * Celseup1 = max(max(C, O), up1[1] - (up1[1] - C) * alpha)up2 = max(max(C * C, O * O), up2[1] - (up2[1] - C * C) * alpha)dn1 = min(min(C, O), dn1[1] + (C - dn1[1]) * alpha)dn2 = min(min(C * C, O * O), dn2[1] + (C * C - dn2[1]) * alpha)endif//Componentsbull = sqrt(dn2 - dn1 * dn1)bear = sqrt(up2 - up1 * up1)maxi = max(bull, bear)signal = ExponentialAverage[siglength](maxi)return bull as "Bullish Component" coloured(8,153,129), bear as "Bearish Component" coloured(242,54,69), signal as "Signal" coloured(255,152,0)08/19/2022 at 4:59 PM #199254 -
AuthorPosts
Find exclusive trading pro-tools on