FX:XAUUSD   Gold/U.S. Dollar
57 0 1
@NishenduVyas

Copy paste the following to your pine editor. and save it as a script and add it to your chart.

//
// @author LazyBear
// Generic Trix Ribbon plotter. Marks all EMA crossings, if configured to true.
//
//
study(title="Trix Ribbon ", shorttitle="TrixRB_LB", overlay=false)
src = close
trix1_color = #00ffff
trix2_color = #ff9800
trix3_color = #cc4125
trix4_color = #00ff00
trix5_color = #000080
trix6_color = #008080
trix7_color = #ff3366

calc_trix(source, length)=>
10000 * change(ema(ema(ema(log(source), length), length), length))

draw_cross=input(false, "Draw Cross points?", type=bool)

trix1_p=input(7, title="TRIX 1 Length", type=integer)
trix2_p=input(10, title="TRIX 2 Length", type=integer)
trix3_p=input(11, title="TRIX 3 Length", type=integer)
trix4_p=input(12, title="TRIX 4 Length", type=integer)
trix5_p=input(13, title="TRIX 5 Length", type=integer)
trix6_p=input(14, title="TRIX 6 Length", type=integer)
trix7_p=input(15, title="TRIX 7 Length", type=integer)

trix1_valid = trix1_p > 0
trix2_valid = trix2_p > 0
trix3_valid = trix3_p > 0
trix4_valid = trix4_p > 0
trix5_valid = trix5_p > 0
trix6_valid = trix6_p > 0
trix7_valid = trix7_p > 0

trix1 = trix1_valid ? calc_trix(src, trix1_p) : na
trix2 = trix2_valid ? calc_trix(src, trix2_p) : na
trix3 = trix3_valid ? calc_trix(src, trix3_p) : na
trix4 = trix4_valid ? calc_trix(src, trix4_p) : na
trix5 = trix5_valid ? calc_trix(src, trix5_p) : na
trix6 = trix6_valid ? calc_trix(src, trix6_p) : na
trix7 = trix7_valid ? calc_trix(src, trix7_p) : na

trix1_cross= trix1_valid ? cross(trix1, trix2) or cross(trix1, trix3) or cross(trix1, trix4) or cross(trix1, trix5) or cross(trix1, trix6) or cross(trix1, trix7) : na
trix2_cross= trix2_valid ? cross(trix2, trix3) or cross(trix2, trix4) or cross(trix2, trix5) or cross(trix2, trix6) or cross(trix2, trix7) : na
trix3_cross= trix3_valid ? cross(trix3, trix4) or cross(trix3, trix5) or cross(trix3, trix6) or cross(trix3, trix7) : na
trix4_cross= trix4_valid ? cross(trix4, trix5) or cross(trix4, trix6) or cross(trix4, trix7): na
trix5_cross= trix5_valid ? cross(trix5, trix6) or cross(trix5, trix7): na
trix6_cross= trix6_valid ? cross(trix6, trix7) : na


// Plot the Ribbon
l_trix1=plot(trix1_valid ? trix1 : na, color = trix1_color, linewidth = 2)
l_trix2=plot(trix2_valid ? trix2 : na, color = trix2_color, linewidth = 2)
l_trix3=plot(trix3_valid ? trix3 : na, color = trix3_color, linewidth = 2)
l_trix4=plot(trix4_valid ? trix4 : na, color = trix4_color, linewidth = 2)
l_trix5=plot(trix5_valid ? trix5 : na, color = trix5_color, linewidth = 2)
l_trix6=plot(trix6_valid ? trix6 : na, color = trix6_color, linewidth = 2)
l_trix7=plot(trix7_valid ? trix7 : na, color = trix7_color, linewidth = 2)

fill(l_trix1, l_trix2, trix1_color)
fill(l_trix2, l_trix3, trix2_color)
fill(l_trix3, l_trix4, trix3_color)
fill(l_trix4, l_trix5, trix4_color)
fill(l_trix5, l_trix6, trix5_color)
fill(l_trix6, l_trix7, trix6_color)

// Plot any crossings
plot(not na(trix1_cross) and draw_cross and trix1_cross ? trix1 : na, style = circles, linewidth = 4 , color = trix1_color)
plot(not na(trix2_cross) and draw_cross and trix2_cross ? trix2 : na, style = circles, linewidth = 4 , color = trix2_color)
plot(not na(trix3_cross) and draw_cross and trix3_cross ? trix3 : na, style = circles, linewidth = 4 , color = trix3_color)
plot(not na(trix4_cross) and draw_cross and trix4_cross ? trix4 : na, style = circles, linewidth = 4 , color = trix4_color)
plot(not na(trix5_cross) and draw_cross and trix5_cross ? trix5 : na, style = circles, linewidth = 4 , color = trix5_color)
plot(not na(trix6_cross) and draw_cross and trix6_cross ? trix6 : na, style = circles, linewidth = 4 , color = trix6_color)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out