conversion code tradingwiew ” Redk VADER V4.0″
Forums › ProRealTime forum Français › Support ProBuilder › conversion code tradingwiew ” Redk VADER V4.0″
- This topic has 2 replies, 2 voices, and was last updated 2 weeks ago by
larouedegann.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
04/11/2025 at 9:11 PM #245837
Bonjour à tous,
Une ame charitable pour traduire ce code tradingwiew.
Merci123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136// © RedKTrader//@version=5indicator('RedK Volume-Accelerated Directional Energy Ratio', 'RedK VADER v4.0', precision=0, timeframe='', timeframe_gaps=false)// ***********************************************************************************************************// Choose MA type for the base DER calculation ..// WMA is my preference and is default .. SMA is really slow and lags a lot - but added for comparisonf_derma(_data, _len, MAOption) =>value =MAOption == 'SMA' ? ta.sma(_data, _len) :MAOption == 'EMA' ? ta.ema(_data, _len) :ta.wma(_data, _len)// ***********************************************************************************************************// ===========================================================================================================// Inputs// ===========================================================================================================price = closelength = input.int(10, minval=1)DER_avg = input.int(5, 'Average', minval=1, inline='DER', group='Directional Energy Ratio')MA_Type = input.string('WMA', 'DER MA type', options=['WMA', 'EMA', 'SMA'], inline='DER', group='Directional Energy Ratio')smooth = input.int(3, 'Smooth', minval=1, inline='DER_1', group='Directional Energy Ratio')show_senti = input.bool(false, 'Sentiment', inline='DER_s', group='Directional Energy Ratio')senti = input.int(20, 'Length', minval=1, inline='DER_s', group='Directional Energy Ratio')v_calc = input.string('Relative', 'Calculation', options=['Relative', 'Full', 'None'], group='Volume Parameters')vlookbk = input.int(20, 'Lookback (for Relative)', minval=1, group='Volume Parameters')// ===========================================================================================================// Calculations// ===========================================================================================================// Volume Calculation Option -- will revert to no volume acceleration for instruments with no volume data// v4.0 => updated Relative Volume calculation fix per @m_b_roundv = volumevola =v_calc == 'None' or na(volume) ? 1 :v_calc == 'Relative' ? ta.stoch(v, v, v, vlookbk) / 100 :vR = (ta.highest(2) - ta.lowest(2)) / 2 // R is the 2-bar average bar range - this method accomodates bar gapssr = ta.change(price) / R // calc ratio of change to Rrsr = math.max(math.min(sr, 1), -1) // ensure ratio is restricted to +1/-1 in case of big movesc = fixnan(rsr * vola) // add volume accel -- fixnan adresses cases where no price change between barsc_plus = math.max(c, 0) // calc directional vol-accel energyc_minus = -math.min(c, 0)// plot(c_plus)// plot(c_minus)avg_vola = f_derma(vola, length, MA_Type)dem = f_derma(c_plus, length, MA_Type) / avg_vola // directional energy ratiosup = f_derma(c_minus, length, MA_Type) / avg_volaadp = 100 * ta.wma(dem, DER_avg) // average DERasp = 100 * ta.wma(sup, DER_avg)anp = adp - asp // net DER..anp_s = ta.wma(anp, smooth)// Calculate Sentiment - a VADER for a longer period and can act as a baseline (compared to a static 0 value)// note we're not re-calculating vol_avg, demand or supply energy for sentiment. this would've been a different approachs_adp = 100 * ta.wma(dem, senti) // average DER for sentiment lengths_asp = 100 * ta.wma(sup, senti)V_senti = ta.wma(s_adp - s_asp, smooth)// ===========================================================================================================// Colors & plots// ===========================================================================================================c_adp = color.new(color.aqua, 30)c_asp = color.new(color.orange, 30)c_fd = color.new(color.green, 80)c_fs = color.new(color.red, 80)c_zero = color.new(#ffee00, 70)c_up = color.new(#359bfc, 0)c_dn = color.new(#f57f17, 0)c_sup = color.new(#33ff00, 80)c_sdn = color.new(#ff1111, 80)up = anp_s >= 0s_up = V_senti >=0hline(0, 'Zero Line', c_zero, hline.style_solid)// =============================================================================// v3.0 --- Sentiment will be represented as a 4-color histogramc_grow_above = #1b5e2080c_grow_below = #dc4c4a80c_fall_above = #66bb6a80c_fall_below = #ef8e9880sflag_up = math.abs(V_senti) >= math.abs(V_senti[1])plot(show_senti ? V_senti : na, "Sentiment", style=plot.style_columns,color = s_up ? (sflag_up ? c_grow_above : c_fall_above) :sflag_up ? c_grow_below : c_fall_below)// =============================================================================s = plot(asp, 'Supply Energy', c_asp, 2, style=plot.style_circles, join=true)d = plot(adp, 'Demand Energy', c_adp, 2, style=plot.style_cross, join=true)fill(d, s, adp > asp ? c_fd : c_fs)plot(anp, 'VADER', color.new(color.gray, 30), display=display.none)plot(anp_s, 'Signal', up ? c_up : c_dn, 4)// ===========================================================================================================// v2.0 adding alerts// ===========================================================================================================Alert_up = ta.crossover(anp_s,0)Alert_dn = ta.crossunder(anp_s,0)Alert_swing = ta.cross(anp_s,0)// "." in alert title for the alerts to show in the right order up/down/swingalertcondition(Alert_up, ". VADER Crossing 0 Up", "VADER Up - Buying Energy Detected!")alertcondition(Alert_dn, ".. VADER Crossing 0 Down", "VADER Down - Selling Energy Detected!")alertcondition(Alert_swing, "... VADER Crossing 0", "VADER Swing - Possible Reversal")// ===========================================================================================================// v3.0 more alerts for VADER crossing Sentiment// ===========================================================================================================v_speedup = ta.crossover(anp_s, V_senti)v_slowdn = ta.crossunder(anp_s, V_senti)alertcondition(v_speedup, "* VADER Speeding Up", "VADER Speeding Up!")alertcondition(v_slowdn, "** VADER Slowing Down", "VADER Slowing Down!")04/15/2025 at 2:48 PM #245915Bonjour. Ici vous avez :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106//--------------------------------------------////PRC_Volume Accelerated Directional Energy Ratio//version = 0//15.04.25//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//--------------------------------------------//// Inputs//--------------------------------------------//src=closelength=10deravg=5matype=2smooth=3showsenti=1senti=20vcalc=1 //1=Relative, 2=full, 0=nonevlookback=20//--------------------------------------------//// Calculations//--------------------------------------------//v=volumeif vcalc=0 thenvola=1elsif vcalc=1 thenvola=(v-lowest[length](v))/(highest[length](v)-lowest[length](v))elsevola=vendifr=(highest[2](high)-lowest[2](low))/2sr=(src-src[1])/rrsr=max(min(sr,1),-1)c=rsr*volacplus=max(c,0)cminus=-min(c,0)avgvola=average[length,matype](vola)dem=average[length,matype](cplus)/avgvolasup=average[length,matype](cminus)/avgvolaadp=100*average[deravg,2](dem)asp=100*average[deravg,2](sup)anp=adp-aspanps=average[smooth,2](anp)sadp=100*average[senti,2](dem)sasp=100*average[senti,2](sup)vsenti=average[smooth,2](sadp-sasp)//--------------------------------------------//// Colors and plot//--------------------------------------------//if vsenti>=0 thenif abs(vsenti)>=abs(vsenti[1]) thenred=27green=94blue=32alpha=100elsered=107green=187blue=106alpha=100endifelseif abs(vsenti)>=abs(vsenti[1]) thenred=220green=76blue=74alpha=100elsered=239green=142blue=152alpha=100endifendifif showsenti thenplotsenti=vsentielseplotsenti=undefinedendifif asp>adp thenr1=255g1=0b1=0elser1=0g1=255b1=0endifcolorbetween(asp,adp,r1,g1,b1,50)if anps>0 thenr3=64g3=112b3=255elser3=255g3=143b3=53endif//--------------------------------------------//return anps coloured(r3,g3,b3)style(line,4),asp coloured("orange")style(line,2),adp coloured("aqua")style(line,2),0 as "Zero" coloured("yellow"), plotsenti as "Sentiment" style(histogram)coloured(red,green,blue,alpha)04/15/2025 at 6:12 PM #245919 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: