Conversion code TSI depuis celui de TradingView
Forums › ProRealTime forum Français › Support ProBuilder › Conversion code TSI depuis celui de TradingView
- This topic has 5 replies, 2 voices, and was last updated 2 years ago by
maxlys.
Tagged: True Strength Index, TSI
-
-
07/28/2022 at 8:18 AM #198010
Bonjour,
Su TV, j’utilise un TSI avec parametres 34.5.13 (affichage en point pour ligne parametre 3 et le signal en rouge ligne pleine, voir photo jointe) dont voici le code :
12345678910111213141516//@version=5indicator("True Strength Indicator", shorttitle="TSI", format=format.price, precision=4, timeframe="", timeframe_gaps=true)long = input(title="Long Length", defval=25)short = input(title="Short Length", defval=13)signal = input(title="Signal Length", defval=13)price = closedouble_smooth(src, long, short) =>fist_smooth = ta.ema(src, long)ta.ema(fist_smooth, short)pc = ta.change(price)double_smoothed_pc = double_smooth(pc, long, short)double_smoothed_abs_pc = double_smooth(math.abs(pc), long, short)tsi_value = 100 * (double_smoothed_pc / double_smoothed_abs_pc)plot(tsi_value, color=#2962FF)plot(ta.ema(tsi_value, signal), color=#E91E63)hline(0, title="Zero", color=#787B86)Ensuite sur ce même indicateur j’applique une SMA50 basé sur le TSI 3 (en points)
Code TV :123456789101112131415161718192021//@version=5indicator(title="Moving Average", shorttitle="MA", overlay=true, timeframe="", timeframe_gaps=true)len = input.int(9, minval=1, title="Length")src = input(close, title="Source")offset = input.int(title="Offset", defval=0, minval=-500, maxval=500)out = ta.sma(src, len)plot(out, color=color.blue, title="MA", offset=offset)ma(source, length, type) =>switch type"SMA" => ta.sma(source, length)"EMA" => ta.ema(source, length)"SMMA (RMA)" => ta.rma(source, length)"WMA" => ta.wma(source, length)"VWMA" => ta.vwma(source, length)typeMA = input.string(title = "Method", defval = "SMA", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Smoothing")smoothingLength = input.int(title = "Length", defval = 5, minval = 1, maxval = 100, group="Smoothing")smoothingLine = ma(out, smoothingLength, typeMA)plot(smoothingLine, title="Smoothing Line", color=#f37f20, offset=offset, display=display.none)Est-il possible d’obtenir une transcription de ces 2 codes en un seul pour PRT ?
Le top serait d’avoir les parametres de chaque signal modifiable par le menu de l’indicateur directement au lieu d’aller dans le code a chaque fois.
Avec le TSI proposé sur PRT en natif je n’obtiens pas les mêmes choses.En vous remerciant
07/28/2022 at 8:21 AM #198012L’indicateur TSI se trouve ici: True Strength Index TSI
On peut lui appliquer une moyenne mobile via la liste des indicateurs de la plateforme ensuite.
07/28/2022 at 8:22 AM #198013Autre version, sans doute plus proche car avec la ligne de signal: https://www.prorealcode.com/topic/tsi-osc-mt4-pour-prorealtime/
07/28/2022 at 8:46 AM #19801707/29/2022 at 11:13 AM #198070Ci-dessous le code de cette version du TSI convertit pour ProRealTime.
12345678910111213//"True Strength Indicator"long = 25//Long Lengthshort = 13 //Short Lengthsignal = 13 //Signal Lengthiprice = closepc = Variation(iprice)doublesmoothedpc = average[short,1](average[long,1](pc))doublesmoothedabspc = average[short,1](average[long,1](abs(pc)))tsivalue = 100 * (doublesmoothedpc / doublesmoothedabspc)return tsivalue coloured(41, 98, 255),average[signal,1](tsivalue) coloured(233, 30, 99),0 coloured(120, 123, 134)Tu n’as plus qu’a appliquer la moyenne mobile de ton choix sur la valeur de l’indicateur.
07/29/2022 at 5:21 PM #198085 -
AuthorPosts
Find exclusive trading pro-tools on