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 :
//@version=5
indicator("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 = close
double_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 :
//@version=5
indicator(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