RedK Magic Ribbon v6.0
"RedK Magic Ribbon" by RedKTrader, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: RedK Magic Ribbon (v8.0), read 2026-10-12T16:17:34.803Z; source language v6.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
RedK Magic Ribbon by RedKTrader, ported from Pine v6. Overlay indicator with 7 plots, 1 fill, alerts and 24 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RedKTrader
// ------------------------------------------------------------------------------------------------
// Original author: RedKTrader
// Original title: RedK Magic Ribbon
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 6
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=6
indicator('RedK Magic Ribbon v6.0', shorttitle='MagicRibbon v6.0', overlay=true, timeframe='', timeframe_gaps=false)
//======================================================================
// Jan31, 2023: Release Notes for version 5.0
// ------------------------------
// Add more optional MA's and standardizing their colors for consistency with other MA's & charts
// updated LazyLine() with latest version
// display for MA values are only in the data window to reduce clutter
// v5.1: some tweaks to Optional MA's default lenghts and plot width & colors
// ===========================================================================
// May 2026: v6.0 Release Notes: most changes are to support my new RAdar Tri-VIEW system
// - Upgrade script to Pine v6
// - Use the broader getMA function
// - Allow selection of ProxyMA type (was slow MA in v5.x and fixed to WSS_WMA)
// - Add "selectable" markers when ProxyMA, Mood and Context all align Bullish or Bearish
// - Adjust MA default lengths for initial Tri-VIEW values
//====================================================================
f_LazyLine(_data, _length) =>
w1 = 0
w2 = 0
w3 = 0
L1 = 0.0
L2 = 0.0
L3 = 0.0
w = _length / 3
if _length > 4
w2 := math.round(w)
w1 := math.round((_length - w2) / 2)
w3 := int((_length - w2) / 2)
L1 := ta.wma(_data, w1)
L2 := ta.wma(L1, w2)
L3 := ta.wma(L2, w3)
L3
else
L3 := ta.wma(_data, _length)
L3
L3
//=====================================================================
f_CoraWave(source, length, s) =>
numerator = 0.0
denom = 0.0
c_weight = 0.0
r_multi = 2.0
Start_Wt = 0.01 // Start Weight & r_multi are set to basic values here.
End_Wt = length // use length as initial End Weight to calculate base "r"
r = math.pow(End_Wt / Start_Wt, 1 / (length - 1)) - 1
base = 1 + r * r_multi
for i = 0 to length - 1 by 1
c_weight := Start_Wt * math.pow(base, length - i)
numerator := numerator + source[i] * c_weight
denom := denom + c_weight
denom
cora_raw = numerator / denom
cora_wave = ta.wma(cora_raw, s)
cora_wave
// ======================================================================
// =============================================================================
f_getMA(source, length, mtype) =>
mtype == 'SMA' ? ta.sma(source, length) : mtype == 'EMA' ? ta.ema(source, length) : mtype == 'WMA' ? ta.wma(source, length) : mtype == 'HMA' ? ta.hma(source, length) : f_LazyLine(source, length)
// =============================================================================
Source_1 = input.source(close, 'Source', inline='CRMA1', group='CoRa Wave (Fast MA)')
Length_1 = input.int(10, 'Length', minval=1, inline='CRMA1', group='CoRa Wave (Fast MA)')
smooth = input.int(3, 'Smooth', minval=1, inline='CRMA2', group='CoRa Wave (Fast MA)')
Source_2 = input.source(close, 'Source', inline='ProxyMA', group='Proxy MA')
Source_2_Type = input.string('RSS_WMA', title='Type', inline='ProxyMA', options=['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA'], group='Proxy MA')
Length_2 = input.int(9, 'Length', minval=1, inline='ProxyMA', group='Proxy MA')
ShowFill = input.bool(true, 'Ribbon Fill?', group='Proxy MA')
FastLine = f_CoraWave(Source_1, Length_1, smooth)
SlowLine = f_getMA(Source_2, Length_2, Source_2_Type)
c_fup = color.new(color.aqua, 30)
c_fdn = color.new(color.orange, 30)
Fast_up = FastLine > FastLine[1]
Fast_dn = FastLine < FastLine[1]
c_sup = color.new(#33ff00, 0)
c_sdn = color.new(#ff1111, 0)
Slow_up = SlowLine > SlowLine[1]
Slow_dn = SlowLine < SlowLine[1]
FastPlot = plot(FastLine, title='Fast Line', color=Fast_up ? c_fup : c_fdn, linewidth=2)
SlowPlot = plot(SlowLine, title='Slow Line', color=Slow_up ? c_sup : c_sdn, linewidth=2)
c_rup = color.new(#33ff00, 70)
c_rdn = color.new(#ff1111, 70)
c_rsw = color.new(color.gray, 70)
Ribbon_up = Fast_up and Slow_up
Ribbon_dn = not Fast_up and not Slow_up
fill(FastPlot, SlowPlot, title='Ribbon Fill', color=ShowFill ? (Ribbon_up ? c_rup : Ribbon_dn ? c_rdn : c_rsw) : na)
// ====================================================================================================================
// Mood and Bias MAs
gr_mma = 'Mood & Context MA'
t_Mood_MA = 'Mood MA'
t_Bias_MA = 'Bias MA'
t_flags = 'MA Alignment Markers'
show_Mood_MA = input.bool(false, t_Mood_MA, inline=t_Mood_MA, group=gr_mma)
Mood_MA_type = input.string('SMA', '', options=['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA'], inline=t_Mood_MA, group=gr_mma)
Mood_MA_source = input.source(close, '', inline=t_Mood_MA, group=gr_mma)
Mood_MA_length = input.int(20, '', minval=1, inline=t_Mood_MA, group=gr_mma)
Mood_MA_color = color.new(#ba68c8, 20)
Mood_MA = f_getMA(Mood_MA_source, Mood_MA_length, Mood_MA_type)
plot(show_Mood_MA ? Mood_MA : na, color=Mood_MA_color, title=t_Mood_MA, linewidth=2, display=display.pane + display.data_window)
show_Bias_MA = input.bool(false, t_Bias_MA, inline=t_Bias_MA, group=gr_mma)
Bias_MA_type = input.string('SMA', '', options=['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA'], inline=t_Bias_MA, group=gr_mma)
Bias_MA_source = input.source(close, '', inline=t_Bias_MA, group=gr_mma)
Bias_MA_length = input.int(50, '', minval=1, inline=t_Bias_MA, group=gr_mma)
Bias_MA_color = color.new(#2470f0, 20)
Bias_MA = f_getMA(Bias_MA_source, Bias_MA_length, Bias_MA_type)
plot(show_Bias_MA ? Bias_MA : na, color=Bias_MA_color, title=t_Bias_MA, linewidth=2, display=display.pane + display.data_window)
// if Proxy & Mood & Bias align bullish or bearish, plot the Tri-View markers
show_triFlag = input.bool(true, t_flags, inline=t_flags, group=gr_mma)
triFlag = Slow_up and SlowLine >= Mood_MA and Mood_MA >= Bias_MA ? 1 : Slow_dn and SlowLine <= Mood_MA and Mood_MA <= Bias_MA ? -1 : 0
triFlag_Marker = triFlag == 0 or not show_triFlag ? na : SlowLine
plot(triFlag_Marker, title=t_flags, color=Slow_up ? c_sup : c_sdn, linewidth=3, style=plot.style_circles, display=display.pane)
// ========================================================================================================
gr_ma = 'Additional Moving Averages'
t_ma1 = 'MA #1'
t_ma2 = 'MA #2'
show_ma1 = input.bool(false, t_ma1, inline=t_ma1, group=gr_ma)
ma1_type = input.string('SMA', '', options=['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA'], inline=t_ma1, group=gr_ma)
ma1_source = input.source(close, '', inline=t_ma1, group=gr_ma)
ma1_length = input.int(100, '', minval=1, inline=t_ma1, group=gr_ma)
ma1_color = color.new(#ffeb3b, 0)
ma1 = f_getMA(ma1_source, ma1_length, ma1_type)
plot(show_ma1 ? ma1 : na, color=ma1_color, title=t_ma1, linewidth=1, display=display.pane + display.data_window)
show_ma2 = input.bool(false, t_ma2, inline=t_ma2, group=gr_ma)
ma2_type = input.string('SMA', '', options=['RSS_WMA', 'WMA', 'EMA', 'SMA', 'HMA'], inline=t_ma2, group=gr_ma)
ma2_source = input.source(close, '', inline=t_ma2, group=gr_ma)
ma2_length = input.int(200, '', minval=1, inline=t_ma2, group=gr_ma)
ma2_color = color.new(#b2b5be, 35)
ma2 = f_getMA(ma2_source, ma2_length, ma2_type)
plot(show_ma2 ? ma2 : na, color=ma2_color, title=t_ma2, linewidth=2, display=display.pane + display.data_window)
// ======================================================================================================
// v4.0 adds alerts for Fast and Slow swinging to a new move up or new move down
// This is easier than looking for the visual signal / color change .. as requested
// The main signal is really when the ribbon "agrees" on a spcific color
// ======================================================================================================
Alert_Fastup = Fast_up and not Fast_up[1]
Alert_Fastdn = Fast_dn and not Fast_dn[1]
Alert_Slowup = Slow_up and not Slow_up[1]
Alert_Slowdn = Slow_dn and not Slow_dn[1]
alertcondition(Alert_Fastup, 'Fast Line Swings Up', 'MagicRibbon - Fast Line Swing Up Detected!')
alertcondition(Alert_Fastdn, 'Fast Line Swings Down', 'MagicRibbon - Fast Line Swing Down Detected!')
alertcondition(Alert_Slowup, 'Slow Line Swings Up', 'MagicRibbon - Slow Line Swing Up Detected!')
alertcondition(Alert_Slowdn, 'Slow Line Swings Down', 'MagicRibbon - Slow Line Swing Down Detected!')
This file is under the Mozilla Public License 2.0; it is a port of the original by RedKTrader, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.