Conversion RMI Sniper Trading View
Forums › ProRealTime forum Français › Support ProBuilder › Conversion RMI Sniper Trading View
- This topic has 3 replies, 3 voices, and was last updated 3 months ago by supertiti.
-
-
11/04/2023 at 2:46 PM #223205
Bonjour,
serait-il possible de convertir l’indicateur de TradingViex “Sniper RMI” ?
Avec mes remerciements 🙂
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TZack88//@version=5
indicator(‘RMI Trend Sniper’, overlay=true,max_labels_count = 500)// ** —> Inputs ————- {
var bool positive = false
var bool negative = false
string RSI_group = “RMI Settings”
string mom_group = “Range Vales”
string visual = “Visuals”
int Length = input(14,”RMI Length “,inline = “RMI”,group = RSI_group)
int pmom = input(66,” Positive above”,inline = “rsi1″,group =RSI_group )
int nmom = input(30,”Negative below”,inline = “rsi1”,group =RSI_group )
bool filleshow = input(true,”Show Range MA “,inline = “002”,group =visual )
color bull = input(#00bcd4,””,inline = “002”,group =visual )
color bear = input(#ff5252,””,inline = “002”,group =visual )
float BarRange = high – lowup = ta.rma(math.max(ta.change(close), 0), Length)
down = ta.rma(-math.min(ta.change(close), 0), Length)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 – (100 / (1 + up / down))
mf = ta.mfi(hlc3, Length)
rsi_mfi = math.avg(rsi,mf)//——————- }
bool p_mom = rsi_mfi[1] < pmom and rsi_mfi > pmom and
rsi_mfi > nmom and
ta.change(ta.ema(close,5)) > 0bool n_mom = rsi_mfi < nmom and ta.change(ta.ema(close,5)) < 0 // // ---> Momentums ————- {
if p_mom
positive:= true
negative:= falseif n_mom
positive:= false
negative:= true//
method _Band(int len)=>
math.min (ta.atr (len) * 0.3, close * (0.3/100)) [20] /2 * 8Band = _Band(30)
method rangeMA(float Range,Prd)=>
weight = Range / math.sum(Range, Prd)
sum = math.sum(close * weight, Prd)
tw= math.sum(weight, Prd)
sum / tw// Calculate the RWMA
rwma = rangeMA(BarRange,20)// Plotting the RWMA.
colour = positive ? bull : bear
RWMA = positive ? rwma – Band : negative ? rwma + Band : na
alpha = color.new(color.black, 100)center = plot(filleshow ? RWMA : na, “RRTH”, colour, editable = true)
plot(filleshow ? RWMA : na, “RRTH”, color.new(colour, 70), 2, editable = true)
plot(filleshow ? RWMA : na, “RRTH”, color.new(colour, 80), 3, editable = true)
plot(filleshow ? RWMA : na, “RRTH”, color.new(colour, 90), 4, editable = true)max = RWMA + Band
min = RWMA – Bandtop = plot(filleshow ? max: na, “RRTH”, alpha)
bottom = plot(filleshow ? min: na, “RRTH”, alpha)
fill(top, center, top_value = max, bottom_value = RWMA, bottom_color = color.new(colour, 75), top_color = alpha, editable = true)
fill(center, bottom, top_value = RWMA, bottom_value = min, bottom_color = alpha, top_color = color.new(colour, 75), editable = true)
Barcol = positive ? color.green:color.redif negative and not negative[1]
label.new(bar_index,max+(Band/2),””,color = color.red,size=size.small)
if positive and not positive[1]
label.new(bar_index,min-(Band/2),””,color = color.green,size=size.small,style= label.style_label_up)plotcandle(open, high, low, close,color = Barcol,wickcolor = Barcol,bordercolor = Barcol)
barcolor(color = Barcol)// SPOT Trading Alerts
alertcondition(positive and not positive[1],”BUY”)
alertcondition(negative and not negative[1],”SELL”)03/26/2024 at 7:50 PM #230516Bonjour, voici la traduction et l'explication de l'indicateur : https://www.prorealcode.com/prorealtime-indicators/rmi-trend-sniper-indicator/
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104//PRC_RMI Trend Sniper//version = 0//26.03.24//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-----Inputs----------------------------------------------//Length=14//RMI Lengthpmom=66//Positive abovenmom=30//Negative belowfilleshow=1//Show Range MAcolorbar=1//Color candlesdrawsignals=1//Show arrows//-----RSI and MFI calculation-----------------------------//alpha = 1/length//-----Upsrc1 = max(close-close[1],0)if barindex = length thenup = average[length](src1)elseup = alpha*src1 + (1-alpha)*up[1]endif//-----Downsrc2 = - min(close-close[1],0)if barindex = length thendown = average[length](src2)elsedown = alpha*src2 + (1-alpha)*down[1]endif//-----Rsiif down = 0 thenmyrsi = 100elsif up = 0 thenmyrsi = 0elsemyrsi = 100 - (100/(1+up/down))endif//-----MFImfi = MoneyFlowIndex[length]//-----RsiMfirsimfi = (myrsi+mfi)/2//----------------------------------------------------------////-----Long Short Conditions--------------------------------//ema = average[5,1](close)bpmom = rsimfi[1]<pmom and rsimfi>pmom and rsimfi>nmom and (ema-ema[1])>0bnmom = rsimfi<nmom and (ema-ema[1])<0if bpmom thenpositive = 1negative = 0elsif bnmom thenpositive = 0negative = 1endif//----------------------------------------------------------////------Calculate RWMA--------------------------------------//band = min(averagetruerange[30]*0.3,close*(0.3/100))[20]/2*8barRange = high-lowweight = BarRange/summation[20](BarRange)sum = summation[20](close*weight)tw = summation[20](weight)rwma = sum/twif positive thenrwma = rwma-bandr=0g=188b=212elsif negative thenrwma = rwma+bandr=255g=82b=82elserwma = undefinedendif//------------------------------------------------------------////-----Calculate MA bands-------------------------------------//if filleshow thenmitop = rwma+bandmibot = rwma-bandcolorbetween(mitop,rwma,r,g,b,50)colorbetween(mibot,rwma,r,g,b,50)elsemitop = rwmamibot = rwmaendif//-----------------------------------------------------------////-----Draw signals------------------------------------------//if drawsignals thenif negative and not negative[1] thendrawarrowdown(barindex,mitop+(band/2))coloured("red")elsif positive and not positive[1] thendrawarrowup(barindex,mibot-(band/2))coloured("green")endifendif//-----------------------------------------------------------////-----Color Candles-----------------------------------------//if colorbar thendrawcandle(open,high,low,close)coloured(r,g,b)endif//-----------------------------------------------------------//return rwma as "Rwma"coloured(r,g,b)style(line,3), mitop as "Max"coloured(r,g,b,70)style(line,1),mibot as "Min" coloured(r,g,b,70)style(line,1)1 user thanked author for this post.
08/01/2024 at 9:06 AM #23599908/01/2024 at 4:15 PM #236025Bonjour à tous,
J’aurais voulu modifier la rwma en ajoutant une moyenne mobile comme ceci :
myrwma = average [p,m](rwma)
ou p = periode
m = type de moyenne mobile
Pour autant cette ligne de code ne fonctionne pas ?
Merci si quelqu’un peut me dire d’où vient le problème.
Bons trades
-
AuthorPosts
Find exclusive trading pro-tools on