Traduzione codice TW Rally Base Drop
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Traduzione codice TW Rally Base Drop
- This topic has 2 replies, 2 voices, and was last updated 1 week ago by
Msport71.
-
-
05/21/2025 at 9:37 AM #247428
Buongiorno,
chiedo cortese traduzione codice in oggetto (forse noto ai trader ICT) che mi incuriosisce e vorrei provarlo.
Grazie come sempre per l’aiuto.
https://www.tradingview.com/script/PVsY637u-Rally-Base-Drop-SND-Pivots-LuxAlgo/
// 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/
// © LuxAlgo//@version=6
indicator(“Rally Base Drop SND Pivots [LuxAlgo]”, “LuxAlgo – RBD SND Pivots”, overlay = true, max_lines_count = 500)//———————————————————————————————————————}
//Inputs
//———————————————————————————————————————{len = input.int(3, title = “Length”)
rallyCol = input.color(color.new(#089981,50), title = “Rally Color”)
dropCol = input.color(color.new(#f23645,50),title = “Drop Color”)hideLen = input.int(0, title = “Historical Lookback”,minval = 0, tooltip = “Hide Levels farther than this number of bars back.\n\nNote: 0 = Show All”)
//———————————————————————————————————————}
//UDTs
//———————————————————————————————————————{type pb
float price
int bar//———————————————————————————————————————}
//Basic Variables
//———————————————————————————————————————{gc = close > open
rc = close < openrally = gc and gc[1]
drop = rc and rc[1]
base = not rally and not drop//———————————————————————————————————————}
//Functions
//———————————————————————————————————————{check_rb_piv(_len) =>
var pb piv_hi = pb.new(na,na)
var pb piv_lo = pb.new(na,na)
hst = ta.highest(math.max(close,open),_len)
lst = ta.lowest(math.min(close,open),_len)
for i = 0 to len – 1
if not gc[i] or not rc[len+i]
piv_lo := pb.new(na,na)
break
if i == len-1 and close > open[len+i] and close[len] < close[len+i]
piv_lo := pb.new(low[i],bar_index[i])
box.new(bar_index[len+i],hst[len],bar_index[len],lst[len], bgcolor = dropCol, border_color = dropCol)
box.new(bar_index[i],hst,bar_index,lst, bgcolor = rallyCol, border_color = rallyCol)
for i = 0 to len – 1
if not rc[i] or not gc[len+i]
piv_hi := pb.new(na,na)
break
if i == len-1 and close < open[len+i] and close[len] > close[len+i]
piv_hi := pb.new(high[i],bar_index[i])
box.new(bar_index[len+i],hst[len],bar_index[len],lst[len], bgcolor = rallyCol, border_color = rallyCol)
box.new(bar_index[i],hst,bar_index,lst, bgcolor = dropCol, border_color = dropCol)[piv_hi,piv_lo]
//———————————————————————————————————————}
//Processes
//———————————————————————————————————————{[ph,pl] = check_rb_piv(len)
var his = array.new_line(na)
var los = array.new_line(na)if not na(ph.price)
his.push(line.new(ph.bar,ph.price,bar_index,ph.price, color = dropCol))
if not na(pl.price)
los.push(line.new(pl.bar,pl.price,bar_index,pl.price, color = rallyCol))for [i,ln] in los
if close[1] < ln.get_y1()
los.remove(i)
continue
ln.set_x2(bar_index)
for [i,ln] in his
if close[1] > ln.get_y1()
his.remove(i)
continue
ln.set_x2(bar_index)if hideLen > 0
for bx in box.all
if bx.get_right() < bar_index-(hideLen+(len*2))
bx.delete()
for ln in line.all
if ln.get_x1() < bar_index-(hideLen+(len*2))
ln.delete()//———————————————————————————————————————}
05/22/2025 at 11:06 AM #247479Ecco
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788//----------------------------------------////PRC_Rally Base Drop SND//version = 0//22.05.25//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//----------------------------------------//// Inputs//----------------------------------------//len=3//----------------------------------------//// Basic Variables//----------------------------------------//gc=close>openrc=close<openrally=gc and gc[1]drop=rc and rc[1]base=rally=0 and drop=0atr=averagetruerange[14](close)//----------------------------------------//// Pivots High and Low//----------------------------------------//hst=highest[len](max(close,open))lst=lowest[len](min(close,open))for i=0 to len-1 doif gc[i]=0 or rc[len+i]=0 thenbreakendifif i=len-1 and close>open[len+i] and close[len]<close[len+i] then$pivlow[n+1]=low[i]$pivlowIdx[n+1]=barindex[i]$pivlowBroken[n+1]=0$pivlowBrokenidx[n+1]=barindexn=n+1drawrectangle(barindex[len+i],hst[len],barindex[len],lst[len])coloured("red")fillcolor("red",30)drawrectangle(barindex[i],hst,barindex,lst)coloured("green")fillcolor("green",30)endifnextfor i=0 to len-1 doif rc[i]=0 or gc[len+i]=0 thenbreakendifif i=len-1 and close<open[len+i] and close[len]>close[len+i] then$pivhigh[t+1]=high[i]$pivhighIdx[t+1]=barindex[i]$pivhighBroken[t+1]=0$pivhighBrokenidx[t+1]=barindext=t+1drawrectangle(barindex[len+i],hst[len],barindex[len],lst[len])coloured("green")fillcolor("green",30)drawrectangle(barindex[i],hst,barindex,lst)coloured("red")fillcolor("red",30)endifnextif islastbarupdate thenfor i=n downto 1 dofor k=barindex-($pivlowIdx[i]+1) downto 0 doif low[k]<$pivlow[i] and $pivlowBroken[i]=0 then$pivlowBroken[i]=1$pivlowBrokenidx[i]=barindex[k]breakendifnextif $pivlowBroken[i]=1 thendrawsegment($pivlowIdx[i],$pivlow[i],$pivlowBrokenidx[i],$pivlow[i])coloured("green")elsedrawsegment($pivlowIdx[i],$pivlow[i],barindex,$pivlow[i])coloured("green")endifnextfor i=t downto 1 dofor k=barindex-($pivhighIdx[i]+1) downto 0 doif high[k]>$pivhigh[i] and $pivhighBroken[i]=0 then$pivhighBroken[i]=1$pivhighBrokenidx[i]=barindex[k]breakendifnextif $pivhighBroken[i]=1 thendrawsegment($pivhighIdx[i],$pivhigh[i],$pivhighBrokenidx[i],$pivhigh[i])coloured("red")elsedrawsegment($pivhighIdx[i],$pivhigh[i],barindex,$pivhigh[i])coloured("red")endifnextendif//----------------------------------------//return1 user thanked author for this post.
05/22/2025 at 11:50 AM #247486 -
AuthorPosts
Find exclusive trading pro-tools on