Andean Oscilator conversion
- This topic has 2 replies, 3 voices, and was last updated 2 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
Similar topics:
Forums › ProRealTime forum Français › Support ProBuilder › Andean Oscilator conversion
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”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
// 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") //------------------------------------------------------------------------------ //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 = close O = open up1 := 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) //Components bull = 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) //-----------------------------------------------------------------------------} |
Bonjour, tentative de conversion à tester, en attendant que Nicolas, bien plus habitué à faire les conversions, passe par ce post et valide ou corrige:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
// 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=50 siglength = 9 //-----------------------------------------------------------------------------} //Exponential Envelopes //-----------------------------------------------------------------------------{ alpha = 2/(length+1) //up1 = 0 //up2 = 0 //dn1 = 0 //dn2 = 0 C = close O = open if barindex=0 then up1 = C up2 = C * C dn1 = C dn2 = C * C else up1 = 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 //Components bull = 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) |
Find exclusive trading pro-tools on