Strategy · Pine Script v5 · Own pane

PMAR and Madrid MA Strategy

by hasnocool· code credited to CheatCode1

This strategy combines the Price Moving Average Ratio Percentile (PMARP) with Madrid Moving Average Ribbon concepts to identify overextended price conditions and trend shifts.

View on GitHub

GitHub stars106on the repository
Pine versionv5runs as is
Lines of code521
Settings30inputs
LicenceGPL-3.0
Last update2 years ago18 Sep 2024

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

521 lines of Pine Script v5 from Bitcoin Scalping Strategy (Sampled with- PMARP+MADRID MA RIBBON).pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

Bitcoin Scalping Strategy (Sampled with- PMARP+MADRID MA RIBBON).pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CheatCode1
//@version=5
strategy("PMAR and Madrid MA Strategy Excecuted by @CheatCode1", overlay=false, margin_long=0, margin_short=0, default_qty_type = strategy.cash, initial_capital = 1000, pyramiding = 0, default_qty_value = 1000, max_bars_back = 100)
//
// THIS IS PMARP, AN INDiCATOR CREATED BY @THE_CARETAKER, I DO NOT TAKE CREDIT FOR ANY SCRIPT WRITTEN UNTIL THE START OF THE NEXT INDICATOR. PLEASE REFER TO @The_Caretaker FOR QUESTIONS REGARDING THE PMAR/PMARP INDICATOR. THANK YOU!
    //
// THIS IS PMARP, AN INDiCATOR CREATED BY @THE_CARETAKER, I DO NOT TAKE CREDIT FOR ANY SCRiPT WRITTEN UNTIL THE START OF THE NEXT INDICATOR. PLEASE REFER TO @The_Caretaker FOR QUESTIONS REGARDING THE PMAR/PMARP INDICATOR. THANK YOU!
    //
// THIS IS PMARP, AN INDiCATOR CREATED BY @THE_CARETAKER, I DO NOT TAKE CREDIT FOR ANY SCRIPT WRITTEN UNTIL THE START OF THE NEXT INDICATOR. PLEASE REFER TO @The_Caretaker FOR QUESTIONS REGARDING THE PMAR/PMARP INDICATOR. THANK YOU!
// @version=5
//
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @author = The_Caretaker
// © The_Caretaker
//
// Much respect to Eric Crown for this idea.
// 
// Feel free to reuse or develop this script further, please drop me a note below if you find it useful.
//
///////////////////////////////////////////////////////////////////////////////
// Input default variable declarations
var string s_pmarp = 'Price Moving Average Ratio Percentile'
var string s_pmar  = 'Price Moving Average Ratio'
var string s_BGR   = 'Blue Green Red'
var string s_BR    = 'Blue Red'
var float pmarHigh = 0.0
///////////////////////////////////////////////////////////////////////////////
// Inputs
i_src_price         = input.source  ( close,        'Price source',                                                                         inline='1',     group='Main Properties')
i_p_type_line       = input.string  ( s_pmarp,      'Indicator....',            options=[ s_pmar, s_pmarp ],                                inline='2',     group='Main Properties')
i_ma_len            = input.int     ( 20,           'PMAR length',              minval=1,                                                   inline='3',     group='Main Properties')
i_ma_typ            = input.string  ( 'VWMA',       'MA type...',               options=[ 'SMA', 'EMA', 'HMA', 'RMA', 'VWMA' ],             inline='3',     group='Main Properties')
i_c_typ_line        = input.string  ( 'Spectrum',   'Color type',               options=[ 'Spectrum', 'Solid' ],                            inline='1',     group='Line plot settings')
i_c_typ_spctrm_line = input.string  ( s_BGR,        'Spectrum',                 options=[ s_BR, s_BGR ],                                    inline='1',     group='Line plot settings')
i_c_solid_line      = input.color   ( #FFFF00,      'Solid color',                                                                          inline='1',     group='Line plot settings')
i_p_width_line      = input.int     ( 1,            'Line width',               minval=1, maxval=4,                                         inline='2',     group='Line plot settings')
i_pmarp_lookback    = input.int     ( 350,          'Lookback',                 minval=1, maxval=1900,                                      inline='2',     group='Line plot settings')
i_show_signal_ma    = input.bool    ( true,         'Signal MA',                                                                            inline='0',     group='Signal MA Settings')
i_signal_ma_Len     = input.int     ( 20,           'MA length',                minval=1,                                                   inline='1',     group='Signal MA Settings')
i_signal_ma_typ     = input.string  ( 'SMA',        'MA type',                  options=[ 'SMA', 'EMA', 'HMA', 'RMA', 'VWMA' ],             inline='1',     group='Signal MA Settings')
i_c_typ_sig         = input.string  ( 'Solid',      'Color type',               options=[ 'Spectrum', 'Solid' ],                            inline='2',     group='Signal MA Settings')
i_c_typ_spctrm_sig  = input.string  ( s_BGR,        'Spectrum',                 options=[ s_BR, s_BGR ],                                    inline='2',     group='Signal MA Settings')
i_c_solid_sig       = input.color   ( color.white,  'Solid color',                                                                          inline='2',     group='Signal MA Settings')
i_p_width_sig       = input.int     ( 1,            'Line width',               minval=1, maxval=4,                                         inline='3',     group='Signal MA Settings')
i_hi_alert_pmarp    = input.float   ( 99,           'Hi PMARP alert level',     minval=0.1, maxval=100, step=0.01,                          inline='6',     group='Visual Alert Level Settings')
i_lo_alert_pmarp    = input.float   ( 1,            'Lo PMARP alert level',     minval=0.1, maxval=100, step=0.01,                          inline='6',     group='Visual Alert Level Settings')
i_hi_alert_pmar     = input.float   ( 2.7,          'Hi PMAR alert level.',     minval=0.1, maxval=100, step=0.01,                          inline='7',     group='Visual Alert Level Settings')
i_lo_alert_pmar     = input.float   ( 0.7,          'Lo PMAR alert level.',     minval=0.1, maxval=100, step=0.01,                          inline='7',     group='Visual Alert Level Settings')
i_hi_alert_line_on  = input.bool    ( true,         'Hi alert line.',                                                                       inline='8',     group='Visual Alert Level Settings')
i_lo_alert_line_on  = input.bool    ( true,         'Lo alert line.',                                                                       inline='8',     group='Visual Alert Level Settings')
i_bg_hi_signal_on   = input.bool    ( true,         'Hi signal bars',                                                                       inline='9',     group='Visual Alert Level Settings')
i_bg_lo_signal_on   = input.bool    ( true,         'Lo signal bars',                                                                       inline='9',     group='Visual Alert Level Settings')
///////////////////////////////////////////////////////////////////////////////
// variable declarations
var c_prcntSpctrm1 = array.new_color ( na )
if barstate.isfirst
    array.push ( c_prcntSpctrm1, #0000FF ),
    array.push ( c_prcntSpctrm1, #000AFF ), array.push ( c_prcntSpctrm1, #0014FF ), array.push ( c_prcntSpctrm1, #001FFF ), array.push ( c_prcntSpctrm1, #0029FF ), array.push ( c_prcntSpctrm1, #0033FF ),
    array.push ( c_prcntSpctrm1, #003DFF ), array.push ( c_prcntSpctrm1, #0047FF ), array.push ( c_prcntSpctrm1, #0052FF ), array.push ( c_prcntSpctrm1, #005CFF ), array.push ( c_prcntSpctrm1, #0066FF ),
    array.push ( c_prcntSpctrm1, #0070FF ), array.push ( c_prcntSpctrm1, #007AFF ), array.push ( c_prcntSpctrm1, #0085FF ), array.push ( c_prcntSpctrm1, #008FFF ), array.push ( c_prcntSpctrm1, #0099FF ), 
    array.push ( c_prcntSpctrm1, #00A3FF ), array.push ( c_prcntSpctrm1, #00ADFF ), array.push ( c_prcntSpctrm1, #00B8FF ), array.push ( c_prcntSpctrm1, #00C2FF ), array.push ( c_prcntSpctrm1, #00CCFF ), 
    array.push ( c_prcntSpctrm1, #00D6FF ), array.push ( c_prcntSpctrm1, #00E0FF ), array.push ( c_prcntSpctrm1, #00EBFF ), array.push ( c_prcntSpctrm1, #00F5FF ), array.push ( c_prcntSpctrm1, #00FFFF ), 
    array.push ( c_prcntSpctrm1, #00FFF5 ), array.push ( c_prcntSpctrm1, #00FFEB ), array.push ( c_prcntSpctrm1, #00FFE0 ), array.push ( c_prcntSpctrm1, #00FFD6 ), array.push ( c_prcntSpctrm1, #00FFCC ), 
    array.push ( c_prcntSpctrm1, #00FFC2 ), array.push ( c_prcntSpctrm1, #00FFB8 ), array.push ( c_prcntSpctrm1, #00FFAD ), array.push ( c_prcntSpctrm1, #00FFA3 ), array.push ( c_prcntSpctrm1, #00FF99 ), 
    array.push ( c_prcntSpctrm1, #00FF8F ), array.push ( c_prcntSpctrm1, #00FF85 ), array.push ( c_prcntSpctrm1, #00FF7A ), array.push ( c_prcntSpctrm1, #00FF70 ), array.push ( c_prcntSpctrm1, #00FF66 ), 
    array.push ( c_prcntSpctrm1, #00FF5C ), array.push ( c_prcntSpctrm1, #00FF52 ), array.push ( c_prcntSpctrm1, #00FF47 ), array.push ( c_prcntSpctrm1, #00FF3D ), array.push ( c_prcntSpctrm1, #00FF33 ), 
    array.push ( c_prcntSpctrm1, #00FF29 ), array.push ( c_prcntSpctrm1, #00FF1F ), array.push ( c_prcntSpctrm1, #00FF14 ), array.push ( c_prcntSpctrm1, #00FF0A ), array.push ( c_prcntSpctrm1, #00FF00 ), 
    array.push ( c_prcntSpctrm1, #0AFF00 ), array.push ( c_prcntSpctrm1, #14FF00 ), array.push ( c_prcntSpctrm1, #1FFF00 ), array.push ( c_prcntSpctrm1, #29FF00 ), array.push ( c_prcntSpctrm1, #33FF00 ), 
    array.push ( c_prcntSpctrm1, #3DFF00 ), array.push ( c_prcntSpctrm1, #47FF00 ), array.push ( c_prcntSpctrm1, #52FF00 ), array.push ( c_prcntSpctrm1, #5CFF00 ), array.push ( c_prcntSpctrm1, #66FF00 ), 
    array.push ( c_prcntSpctrm1, #70FF00 ), array.push ( c_prcntSpctrm1, #7AFF00 ), array.push ( c_prcntSpctrm1, #85FF00 ), array.push ( c_prcntSpctrm1, #8FFF00 ), array.push ( c_prcntSpctrm1, #99FF00 ), 
    array.push ( c_prcntSpctrm1, #A3FF00 ), array.push ( c_prcntSpctrm1, #ADFF00 ), array.push ( c_prcntSpctrm1, #B8FF00 ), array.push ( c_prcntSpctrm1, #C2FF00 ), array.push ( c_prcntSpctrm1, #CCFF00 ), 
    array.push ( c_prcntSpctrm1, #D6FF00 ), array.push ( c_prcntSpctrm1, #E0FF00 ), array.push ( c_prcntSpctrm1, #EBFF00 ), array.push ( c_prcntSpctrm1, #F5FF00 ), array.push ( c_prcntSpctrm1, #FFFF00 ), 
    array.push ( c_prcntSpctrm1, #FFF500 ), array.push ( c_prcntSpctrm1, #FFEB00 ), array.push ( c_prcntSpctrm1, #FFE000 ), array.push ( c_prcntSpctrm1, #FFD600 ), array.push ( c_prcntSpctrm1, #FFCC00 ), 
    array.push ( c_prcntSpctrm1, #FFC200 ), array.push ( c_prcntSpctrm1, #FFB800 ), array.push ( c_prcntSpctrm1, #FFAD00 ), array.push ( c_prcntSpctrm1, #FFA300 ), array.push ( c_prcntSpctrm1, #FF9900 ), 
    array.push ( c_prcntSpctrm1, #FF8F00 ), array.push ( c_prcntSpctrm1, #FF8500 ), array.push ( c_prcntSpctrm1, #FF7A00 ), array.push ( c_prcntSpctrm1, #FF7000 ), array.push ( c_prcntSpctrm1, #FF6600 ), 
    array.push ( c_prcntSpctrm1, #FF5C00 ), array.push ( c_prcntSpctrm1, #FF5200 ), array.push ( c_prcntSpctrm1, #FF4700 ), array.push ( c_prcntSpctrm1, #FF3D00 ), array.push ( c_prcntSpctrm1, #FF3300 ), 
    array.push ( c_prcntSpctrm1, #FF2900 ), array.push ( c_prcntSpctrm1, #FF1F00 ), array.push ( c_prcntSpctrm1, #FF1400 ), array.push ( c_prcntSpctrm1, #FF0000 ), array.push ( c_prcntSpctrm1, #FF0000 )
var c_prcntSpctrm2 = array.new_color ( na )
if barstate.isfirst
    array.push ( c_prcntSpctrm2, #0000FF ),
    array.push ( c_prcntSpctrm2, #0200FC ), array.push ( c_prcntSpctrm2, #0500F9 ), array.push ( c_prcntSpctrm2, #0700F7 ), array.push ( c_prcntSpctrm2, #0A00F4 ), array.push ( c_prcntSpctrm2, #0C00F2 ), 
    array.push ( c_prcntSpctrm2, #0F00EF ), array.push ( c_prcntSpctrm2, #1100ED ), array.push ( c_prcntSpctrm2, #1400EA ), array.push ( c_prcntSpctrm2, #1600E8 ), array.push ( c_prcntSpctrm2, #1900E5 ), 
    array.push ( c_prcntSpctrm2, #1C00E2 ), array.push ( c_prcntSpctrm2, #1E00E0 ), array.push ( c_prcntSpctrm2, #2100DD ), array.push ( c_prcntSpctrm2, #2300DB ), array.push ( c_prcntSpctrm2, #2600D8 ),
    array.push ( c_prcntSpctrm2, #2800D6 ), array.push ( c_prcntSpctrm2, #2B00D3 ), array.push ( c_prcntSpctrm2, #2D00D1 ), array.push ( c_prcntSpctrm2, #3000CE ), array.push ( c_prcntSpctrm2, #3300CC ),
    array.push ( c_prcntSpctrm2, #3500C9 ), array.push ( c_prcntSpctrm2, #3800C6 ), array.push ( c_prcntSpctrm2, #3A00C4 ), array.push ( c_prcntSpctrm2, #3D00C1 ), array.push ( c_prcntSpctrm2, #3F00BF ), 
    array.push ( c_prcntSpctrm2, #4200BC ), array.push ( c_prcntSpctrm2, #4400BA ), array.push ( c_prcntSpctrm2, #4700B7 ), array.push ( c_prcntSpctrm2, #4900B5 ), array.push ( c_prcntSpctrm2, #4C00B2 ),
    array.push ( c_prcntSpctrm2, #4F00AF ), array.push ( c_prcntSpctrm2, #5100AD ), array.push ( c_prcntSpctrm2, #5400AA ), array.push ( c_prcntSpctrm2, #5600A8 ), array.push ( c_prcntSpctrm2, #5900A5 ), 
    array.push ( c_prcntSpctrm2, #5B00A3 ), array.push ( c_prcntSpctrm2, #5E00A0 ), array.push ( c_prcntSpctrm2, #60009E ), array.push ( c_prcntSpctrm2, #63009B ), array.push ( c_prcntSpctrm2, #660099 ),
    array.push ( c_prcntSpctrm2, #680096 ), array.push ( c_prcntSpctrm2, #6B0093 ), array.push ( c_prcntSpctrm2, #6D0091 ), array.push ( c_prcntSpctrm2, #70008E ), array.push ( c_prcntSpctrm2, #72008C ), 
    array.push ( c_prcntSpctrm2, #750089 ), array.push ( c_prcntSpctrm2, #770087 ), array.push ( c_prcntSpctrm2, #7A0084 ), array.push ( c_prcntSpctrm2, #7C0082 ), array.push ( c_prcntSpctrm2, #7F007F ),
    array.push ( c_prcntSpctrm2, #82007C ), array.push ( c_prcntSpctrm2, #84007A ), array.push ( c_prcntSpctrm2, #870077 ), array.push ( c_prcntSpctrm2, #890075 ), array.push ( c_prcntSpctrm2, #8C0072 ), 
    array.push ( c_prcntSpctrm2, #8E0070 ), array.push ( c_prcntSpctrm2, #91006D ), array.push ( c_prcntSpctrm2, #93006B ), array.push ( c_prcntSpctrm2, #960068 ), array.push ( c_prcntSpctrm2, #990066 ),
    array.push ( c_prcntSpctrm2, #9B0063 ), array.push ( c_prcntSpctrm2, #9E0060 ), array.push ( c_prcntSpctrm2, #A0005E ), array.push ( c_prcntSpctrm2, #A3005B ), array.push ( c_prcntSpctrm2, #A50059 ), 
    array.push ( c_prcntSpctrm2, #A80056 ), array.push ( c_prcntSpctrm2, #AA0054 ), array.push ( c_prcntSpctrm2, #AD0051 ), array.push ( c_prcntSpctrm2, #AF004F ), array.push ( c_prcntSpctrm2, #B2004C ), 
    array.push ( c_prcntSpctrm2, #B50049 ), array.push ( c_prcntSpctrm2, #B70047 ), array.push ( c_prcntSpctrm2, #BA0044 ), array.push ( c_prcntSpctrm2, #BC0042 ), array.push ( c_prcntSpctrm2, #BF003F ), 
    array.push ( c_prcntSpctrm2, #C1003D ), array.push ( c_prcntSpctrm2, #C4003A ), array.push ( c_prcntSpctrm2, #C60038 ), array.push ( c_prcntSpctrm2, #C90035 ), array.push ( c_prcntSpctrm2, #CC0033 ),
    array.push ( c_prcntSpctrm2, #CE0030 ), array.push ( c_prcntSpctrm2, #D1002D ), array.push ( c_prcntSpctrm2, #D3002B ), array.push ( c_prcntSpctrm2, #D60028 ), array.push ( c_prcntSpctrm2, #D80026 ), 
    array.push ( c_prcntSpctrm2, #DB0023 ), array.push ( c_prcntSpctrm2, #DD0021 ), array.push ( c_prcntSpctrm2, #E0001E ), array.push ( c_prcntSpctrm2, #E2001C ), array.push ( c_prcntSpctrm2, #E50019 ),
    array.push ( c_prcntSpctrm2, #E80016 ), array.push ( c_prcntSpctrm2, #EA0014 ), array.push ( c_prcntSpctrm2, #ED0011 ), array.push ( c_prcntSpctrm2, #EF000F ), array.push ( c_prcntSpctrm2, #F2000C ), 
    array.push ( c_prcntSpctrm2, #F4000A ), array.push ( c_prcntSpctrm2, #F70007 ), array.push ( c_prcntSpctrm2, #F90005 ), array.push ( c_prcntSpctrm2, #FC0002 ), array.push ( c_prcntSpctrm2, #FF0000 )
///////////////////////////////////////////////////////////////////////////////
// Function Declarations
f_prior_sum ( _P, _X ) =>
    math.sum ( _P[1], _X - 1 )
f_ma_val ( _P, _typ, _len ) =>
    _typ == 'SMA' ? ta.sma ( _P, _len ) : _typ == 'EMA' ? ta.ema ( _P, _len ) : _typ == 'RMA' ? ta.rma ( _P, _len ) : _typ == 'HMA' ? ta.hma ( _P, _len ) : ta.vwma ( _P, _len )
f_pmarp ( _price, _pmarLen, _pmarpLen, _type ) =>
    _pmar = math.abs ( _price / f_ma_val ( _price, _type, _pmarLen ))
    _pmarpSum = 0
    _len = bar_index < _pmarpLen ? bar_index : _pmarpLen
    for i = 1 to _len by 1
        _pmarpSum += ( _pmar[i] > _pmar ? 0 : 1 )
        _pmarpSum
    _return = bar_index >= _pmarLen ? _pmarpSum / _len * 100 : na
f_clrSlct ( _percent, _select, _type, _solid, _array1, _array2 ) =>
    _select == 'Solid' ? _solid : array.get ( _type == 'Blue Green Red' ? _array1 : _array2, math.round ( _percent ))
/////////////////////////////////////////////////////////////////////////////// 
// calculations
pmarpOn     = i_p_type_line == 'Price Moving Average Ratio Percentile'
ma          = f_ma_val ( i_src_price, i_ma_typ, i_ma_len )
pmar        = i_src_price / ma
pmarp       = f_pmarp ( i_src_price, i_ma_len, i_pmarp_lookback, i_ma_typ )
pmarHigh := pmar > pmarHigh ? pmar : pmarHigh
c_pmar      = ( pmar / pmarHigh )*100
plotline    = pmarpOn ? pmarp : pmar
c_plotline  = f_clrSlct ( pmarpOn ? plotline : c_pmar,  i_c_typ_line,    i_c_typ_spctrm_line, i_c_solid_line, c_prcntSpctrm1, c_prcntSpctrm2 )
signal_ma   = f_ma_val  ( plotline,  i_signal_ma_typ, i_signal_ma_Len )
c_plotsig   = f_clrSlct ( signal_ma, i_c_typ_sig,     i_c_typ_spctrm_sig,  i_c_solid_sig,  c_prcntSpctrm1, c_prcntSpctrm2 )
hi_alert    = pmarpOn ? i_hi_alert_pmarp : i_hi_alert_pmar
lo_alert    = pmarpOn ? i_lo_alert_pmarp : i_lo_alert_pmar
hi_alertc   = pmarpOn ? i_hi_alert_pmarp : i_hi_alert_pmar > pmarHigh ? 100 : ( i_hi_alert_pmar / pmarHigh ) * 100
c_hi_alert  = f_clrSlct ( hi_alertc, i_c_typ_line, i_c_typ_spctrm_sig,  i_c_solid_sig,  c_prcntSpctrm1, c_prcntSpctrm2 )
c_lo_alert  = f_clrSlct ( lo_alert, i_c_typ_line, i_c_typ_spctrm_sig,  i_c_solid_sig,  c_prcntSpctrm1, c_prcntSpctrm2 )
c_bg        = color.new ( f_clrSlct ( pmarp,    i_c_typ_line, i_c_typ_spctrm_line, i_c_solid_line, c_prcntSpctrm1, c_prcntSpctrm2 ), 50 )
p_hi_alert  = plotline > hi_alert
p_lo_alert  = plotline < lo_alert
///////////////////////////////////////////////////////////////////////////////
// Line Plot
p_scaleHi   = plot ( pmarpOn ? 100 : na, 'Scale high', #ff0000, style = plot.style_line )
p_midLine   = plot ( pmarpOn ? 50  : na, 'Midline',   #555555, style = plot.style_line )
p_scaleLo   = plot ( pmarpOn ? 0   : na, 'Scale low',  #0000ff, style = plot.style_line )
plot ( plotline, 'Plot line', c_plotline, i_p_width_line, editable=false )
plot ( pmarpOn ? na : pmarHigh, 'Historical PMAR high', f_clrSlct ( 100, i_c_typ_line, i_c_typ_spctrm_line, i_c_solid_line, c_prcntSpctrm1, c_prcntSpctrm2 ), i_p_width_line, editable=false )
plot ( i_show_signal_ma ? signal_ma : na, 'Signal line', c_plotsig, i_p_width_sig, editable=false )
plot ( i_hi_alert_line_on and pmarpOn ? i_hi_alert_pmarp : i_hi_alert_pmar, 'High alert level', c_hi_alert, style = plot.style_line )
plot ( i_lo_alert_line_on and pmarpOn ? i_lo_alert_pmarp : i_lo_alert_pmar, 'Low alert level', c_lo_alert, style = plot.style_line )
bgcolor ( p_hi_alert and i_hi_alert_line_on and i_bg_hi_signal_on ? c_bg : na )
bgcolor ( p_lo_alert and i_lo_alert_line_on and i_bg_lo_signal_on ? c_bg : na )
///////////////////////////////////////////////////////////////////////////////
// End
// THIS IS PMARP, AN INDiCATOR CREATED BY @THE_CARETAKER, I DO NOT TAKE CREDIT FOR ANY CODE WRITTEN ABOVE HERE. PLEASE REFER TO @The_Caretaker FOR QUESTIONS REGARDING THE PMAR/PMARP INDICATOR. THANK YOU!
// THIS IS PMARP, AN INDiCATOR CREATED BY @THE_CARETAKER, I DO NOT TAKE CREDIT FOR ANY CODE WRITTEN ABOVE HERE. PLEASE REFER TO @The_Caretaker FOR QUESTIONS REGARDING THE PMAR/PMARP INDICATOR. THANK YOU!
//
    //
    //
    
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT BELOW UNTIL THE END OF THE INDICATOR IS STATED. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
    //
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT BELOW UNTIL THE END OF THE INDICATOR IS STATED. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
    //
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT BELOW UNTIL THE END OF THE INDICATOR IS STATED. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                                                                              ║
// ║ © Madrid : 141017TH2251                                                      ║
// ║                                                                              
// ║ Rev. 210306SA1836 : Upgrade to Pinescript 4                                  ║
// ║                                                                              ║
// ║ Madrid Moving Average Ribbon                                                 ║
// ║                                                                              ║
// ║ This plots a moving average ribbon, either exponential or standard.          ║
// ║ This study is best viewed with a dark background.  It provides an easy       ║
// ║ and fast way to determine the trend direction and possible reversals.        ║
// ║                                                                              ║
// ║ Lime : Uptrend. Long trading                                                 ║
// ║ Green : Reentry (buy the dip) or downtrend reversal warning                  ║
// ║ Red : Downtrend. Short trading                                               ║
// ║ Maroon : Short Reentry (sell the peak) or uptrend reversal warning           ║
// ║                                                                              ║
// ║ To best determine if this is a reentry point or a trend reversal             ║
// ║ the MMARB (Madrid Moving Average Ribbon Bar) study is used.                  ║
// ║ This is the bar located at the bottom.  This bar signals when a              ║
// ║ current trend reentry is found (partially filled with opposite dark color)   ║
// ║ or when a trend reversal is ahead (filled with the opposite color.           ║
// ║                                                                              ║
// ║ This source code is subject to the terms of the Mozilla Public License 2.0   ║
// ║ at https://mozilla.org/MPL/2.0/                                              ║
// ║                                                                              ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// ╔══════════════════════════════════════╗
// ║                                      ║
// ║            CONSTANTS                 ║
// ║                                      ║
// ╚══════════════════════════════════════╝
PHI = (1 + math.sqrt(5)) / 2
PI = 104348 / 33215
BULL = 1
BEAR = -1
NONE = 0
// ╔══════════════════════════════════════╗
// ║                                      ║
// ║            Colors                    ║
// ║                                      ║
// ╚══════════════════════════════════════╝
// v3 Style Gradient
GRN01 = #7CFC00
GRN02 = #32CD32
GRN03 = #228B22
GRN04 = #006400
GRN05 = #008000
GRN06 = #093507
RED01 = #FF4500
RED02 = #FF0000
RED03 = #B22222
RED04 = #8B0000
RED05 = #800000
RED06 = #330d06
// ──────────[ v3 Style Colors ]
AQUA = #00FFFF
BLACK = #000000
BLUE = #0000FF
FUCHSIA = #FF00FF
GRAY = #808080
GREEN = #008000
LIME = #00FF00
MAROON = #800000
NAVY = #000080
OLIVE = #808000
ORANGE = #FF7F00
PURPLE = #800080
RUBI = #FF0000
SILVER = #C0C0C0
TEAL = #008080
YELLOW = #FFFF00
WHITE = #FFFFFF
// ╔══════════════════════════════════════╗
// ║                                      ║
// ║            functions ()              ║
// ║                                      ║
// ╚══════════════════════════════════════╝
// ──────────[ Moving Average Color ]
//  
maColor(_ma, _maRef) =>
    diffMA = ta.change(_ma)
    macol = diffMA >= 0 and _ma > _maRef ? LIME : diffMA < 0 and _ma > _maRef ? MAROON : diffMA <= 0 and _ma < _maRef ? RUBI : diffMA >= 0 and _ma < _maRef ? GREEN : GRAY
    macol
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                                                                              ║
// ║                                main ( )                                      ║
// ║                                                                              ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// ────────────────────[ Input Parameters ]
i_exp = input(true, title='Expnential MA')
// ────────────────────[ Processing ]
src = close
ma05 = i_exp ? ta.ema(src, 05) : ta.sma(src, 05)
ma10 = i_exp ? ta.ema(src, 10) : ta.sma(src, 10)
ma15 = i_exp ? ta.ema(src, 15) : ta.sma(src, 15)
ma20 = i_exp ? ta.ema(src, 20) : ta.sma(src, 20)
ma25 = i_exp ? ta.ema(src, 25) : ta.sma(src, 25)
ma30 = i_exp ? ta.ema(src, 30) : ta.sma(src, 30)
ma35 = i_exp ? ta.ema(src, 35) : ta.sma(src, 35)
ma40 = i_exp ? ta.ema(src, 40) : ta.sma(src, 40)
ma45 = i_exp ? ta.ema(src, 45) : ta.sma(src, 45)
ma50 = i_exp ? ta.ema(src, 50) : ta.sma(src, 50)
ma55 = i_exp ? ta.ema(src, 55) : ta.sma(src, 55)
ma60 = i_exp ? ta.ema(src, 60) : ta.sma(src, 60)
ma65 = i_exp ? ta.ema(src, 65) : ta.sma(src, 65)
ma70 = i_exp ? ta.ema(src, 70) : ta.sma(src, 70)
ma75 = i_exp ? ta.ema(src, 75) : ta.sma(src, 75)
ma80 = i_exp ? ta.ema(src, 80) : ta.sma(src, 80)
ma85 = i_exp ? ta.ema(src, 85) : ta.sma(src, 85)
ma90 = i_exp ? ta.ema(src, 90) : ta.sma(src, 90)
ma100 = i_exp ? ta.ema(src, 100) : ta.sma(src, 100)
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                                                                              ║
// ║                That's all Folks !                                            ║
// ║                                                                              ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT ABOVE. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
    //
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT ABOVE. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
    //
// THIS IS MADRID MOVING AVERAGE RIBBON, AN INDICATOR CREATED BY @Madrid. I DO NOT TAKE ANY CREDIT FOR THE SCRIPT ABOVE. FOR ANY QUESTIONS PLEASE REFER TO @Madrid REGARDING THE MADRID MOVING AVERAGE RIBBON INDICATOR, THANK YOU!
//THE SCRIPT BELOW WAS COMPLETED BY @CHEATCODE1 (Myself) LET ME KNOW IF YOU GUYS WANT MORE COLLAB STRATEGIES AND SUBSCRIBE!! THANKS :)
    //
//THE SCRIPT BELOW WAS COMPLETED BY @CHEATCODE1 (Myself) LET ME KNOW IF YOU GUYS WANT MORE COLLAB STRATEGIES AND SUBSCRIBE!! THANKS :)
    //
//THE SCRIPT BELOW WAS COMPLETED BY @CHEATCODE1 (Myself) LET ME KNOW IF YOU GUYS WANT MORE COLLAB STRATEGIES AND SUBSCRIBE!! THANKS :)
//Lime color conditions when true
greenMA_1 = ma05 > ma100
greenMA_2 = ma10 > ma100
greenMA_3 = ma15 > ma100
greenMA_4 = ma20 > ma100 
greenMA_5 = ma25 > ma100
greenMA_6 = ma30 > ma100
greenMA_7 = ma35 > ma100
greenMA_8 = ma40 > ma100
greenMA_9 = ma45 > ma100
greenMA_10 = ma50 > ma100
greenMA_11 = ma55 > ma100
greenMA_12 = ma60 > ma100
greenMA_13 = ma65 > ma100
greenMA_14 = ma70 > ma100
greenMA_15 = ma75 > ma100
greenMA_16 = ma80 > ma100
greenMA_17 = ma85 > ma100
greenMA_18 = ma90 > ma100
//Red color 
redMA_1 = ma05 < ma100
redMA_2 = ma10 < ma100
redMA_3 = ma15 < ma100
redMA_4 = ma20 < ma100 
redMA_5 = ma25 < ma100
redMA_6 = ma30 < ma100
redMA_7 = ma35 < ma100
redMA_8 = ma40 < ma100
redMA_9 = ma45 < ma100
redMA_10 = ma50 < ma100
redMA_11 = ma55 < ma100
redMA_12 = ma60 < ma100
redMA_13 = ma65 < ma100
redMA_14 = ma70 < ma100
redMA_15 = ma75 < ma100
redMA_16 = ma80 < ma100
redMA_17 = ma85 < ma100
redMA_18 = ma90 < ma100
// Difference of color 
Diffma1 = ta.change(ma05)
Diffma2 = ta.change(ma10)
Diffma3 = ta.change(ma15)
Diffma4 = ta.change(ma20)
Diffma5 = ta.change(ma25)
Diffma6 = ta.change(ma30)
Diffma7 = ta.change(ma35)
Diffma8 = ta.change(ma40)
Diffma9 = ta.change(ma45)
Diffma10 = ta.change(ma50)
Diffma11 = ta.change(ma55)
Diffma12 = ta.change(ma60)
Diffma13 = ta.change(ma65)
Diffma14 = ta.change(ma70)
Diffma15 = ta.change(ma75)
Diffma16 = ta.change(ma80)
Diffma17 = ta.change(ma85)
Diffma18 = ta.change(ma90)
//Positive difference values
Diffma1P = ta.change(ma05) >= 0
Diffma2P = ta.change(ma10) >= 0
Diffma3P = ta.change(ma15) >= 0
Diffma4P = ta.change(ma20) >= 0
Diffma5P = ta.change(ma25) >= 0
Diffma6P = ta.change(ma30) >= 0
Diffma7P = ta.change(ma35) >= 0
Diffma8P = ta.change(ma40) >= 0
Diffma9P = ta.change(ma45) >= 0
Diffma10P = ta.change(ma50) >= 0
Diffma11P = ta.change(ma55) >= 0
Diffma12P = ta.change(ma60) >= 0
Diffma13P = ta.change(ma65) >= 0
Diffma14P = ta.change(ma70) >= 0
Diffma15P = ta.change(ma75) >= 0
Diffma16P = ta.change(ma80) >= 0
Diffma17P = ta.change(ma85) >= 0
Diffma18P = ta.change(ma90) >= 0
//Negative difference values
Diffma1N = ta.change(ma05) < 0
Diffma2N = ta.change(ma10) < 0
Diffma3N = ta.change(ma15) < 0
Diffma4N = ta.change(ma20) < 0
Diffma5N = ta.change(ma25) < 0
Diffma6N = ta.change(ma30) < 0
Diffma7N = ta.change(ma35) < 0
Diffma8N = ta.change(ma40) < 0
Diffma9N = ta.change(ma45) < 0
Diffma10N = ta.change(ma50) < 0
Diffma11N = ta.change(ma55) < 0
Diffma12N = ta.change(ma60) < 0
Diffma13N = ta.change(ma65) < 0
Diffma14N = ta.change(ma70) < 0
Diffma15N = ta.change(ma75) < 0
Diffma16N = ta.change(ma80) < 0
Diffma17N = ta.change(ma85) < 0 
Diffma18N = ta.change(ma90) < 0
// Reverse enginnered color boolean's
Lime1 = Diffma1P and greenMA_1
Red1 = Diffma1N and redMA_1
Maroon1 = Diffma1N and greenMA_1
Green1 = Diffma1P and redMA_1
Lime2 = Diffma2P and greenMA_2
Red2 = Diffma2N and redMA_2
Maroon2 = Diffma2N and greenMA_2
Green2 = Diffma2P and redMA_2
Lime3 = Diffma3P and greenMA_3
Red3 = Diffma3N and redMA_3
Maroon3 = Diffma3N and greenMA_3
Green3 = Diffma3P and redMA_3
Lime4 = Diffma4P and greenMA_4
Red4 = Diffma4N and redMA_4
Maroon4 = Diffma4N and greenMA_4
Green4 = Diffma4P and redMA_4
Lime5 = Diffma5P and greenMA_5
Red5 = Diffma5N and redMA_5
Maroon5 = Diffma5N and greenMA_5
Green5 = Diffma5P and redMA_5
Lime6 = Diffma6P and greenMA_6
Red6 = Diffma6N and redMA_6
Maroon6 = Diffma6N and greenMA_6
Green6 = Diffma6P and redMA_6
Lime7 = Diffma7P and greenMA_7
Red7 = Diffma7N and redMA_7
Maroon7 = Diffma7N and greenMA_7
Green7 = Diffma7P and redMA_7
Lime8 = Diffma8P and greenMA_8
Red8 = Diffma8N and redMA_8
Maroon8 = Diffma8N and greenMA_8
Green8 = Diffma8P and redMA_8
Lime9 = Diffma9P and greenMA_9
Red9 = Diffma9N and redMA_9
Maroon9 = Diffma9N and greenMA_9
Green9 = Diffma9P and redMA_9
Lime10 = Diffma10P and greenMA_10
Red10 = Diffma10N and redMA_10
Maroon10 = Diffma10N and greenMA_10
Green10 = Diffma10P and redMA_10
Lime11 = Diffma11P and greenMA_11
Red11 = Diffma11N and redMA_11
Maroon11 = Diffma11N and greenMA_11
Green11 = Diffma11P and redMA_11
Lime12 = Diffma12P and greenMA_12
Red12 = Diffma12N and redMA_12
Maroon12 = Diffma12N and greenMA_12
Green12 = Diffma12P and redMA_12
Lime13 = Diffma13P and greenMA_13
Red13 = Diffma13N and redMA_13
Maroon13 = Diffma13N and greenMA_13
Green13 = Diffma13P and redMA_13
Lime14 = Diffma14P and greenMA_14
Red14 = Diffma14N and redMA_14
Maroon14 = Diffma14N and greenMA_14
Green14 = Diffma14P and redMA_14
Lime15 = Diffma15P and greenMA_15
Red15 = Diffma15N and redMA_15
Maroon15 = Diffma15N and greenMA_15
Green15 = Diffma15P and redMA_15
Lime16 = Diffma16P and greenMA_16
Red16 = Diffma16N and redMA_16
Maroon16 = Diffma16N and greenMA_16
Green16 = Diffma16P and redMA_16
Lime17 = Diffma17P and greenMA_17
Red17 = Diffma17N and redMA_17
Maroon17 = Diffma17N and greenMA_17
Green17 = Diffma17P and redMA_17
Lime18 = Diffma18P and greenMA_18
Red18 = Diffma18N and redMA_18
Maroon18 = Diffma18N and greenMA_18
Green18 = Diffma18P and redMA_18
//combination of Lime/Red conditions when true
lime_Long = Lime1 and Lime2 and Lime3 and Lime4 and Lime5 and Lime6 and Lime7 and Lime8 and Lime9 and Lime10 and Lime11 and Lime12 and Lime13 and Lime14 and Lime15 and Lime16 and Lime17 and Lime18
red_Short = Red1 and Red2 and Red3 and Red4 and Red5 and Red6 and Red7 and Red8 and Red9 and Red10 and Red12 and Red12 and Red13 and Red14 and Red15 and Red16 and Red17 and Red18
maroon_Short = Maroon1 and Maroon2 and Maroon3 and Maroon4 and Maroon5 and Maroon6 and Maroon7 and Maroon8 and Maroon9 and Maroon10 and Maroon11 and Maroon12 and Maroon13 and Maroon14 and Maroon15 and Maroon16 and Maroon17 and Maroon18
green_Long = Green1 and Green2 and Green3 and Green4 and Green5 and Green6 and Green7 and Green8 and Green9 and Green10 and Green11 and Green12 and Green13 and Green14 and Green15 and Green16 and Green17 and Green18
//rsistoch values /
r= ta.rsi(close, 14)
s = ta.stoch(close, 14,1,3)
rP = r <= 55
rM = r >= 75
noREL = strategy.opentrades == 0 and strategy.position_size > 0
noRES = strategy.opentrades == 0 and strategy.position_size < 0
noENGL = close[1] > open[1] 
//Entry executions
if (lime_Long) and not (noREL) and not (noENGL) and not (rP)
    strategy.entry("Long", strategy.long)
if (red_Short) and not (noRES)
    strategy.entry("Short", strategy.short)
//Stop Loss/ Take Profit Variables
entry_index() =>
    strategy.opentrades > 0 ? (bar_index - strategy.opentrades.entry_bar_index(strategy.closedtrades + 1)) : na
    
StopLoss() =>    
    if entry_index() != 0 and strategy.position_size > 0 
        low[1]
    else if entry_index() != 0 and strategy.position_size < 0
        high[1] 
    else
        na
//Exit excecutions
if strategy.position_size > 0 and pmarp >= 99 and red_Short == true
    strategy.close("Long")
if strategy.position_size < 0 and pmarp <= 01
    strategy.close("Short")
    
// if strategy.position_size > 0 
//     strategy.exit("Stop Loss", stop = StopLoss())
// if strategy.position_size < 0
//     strategy.exit("Stop Loss", stop = StopLoss())
// Fixed percentiles for profit taking
takeP = input.float(1, title='Take Profit', group = 'Take Profit and Stop Loss') / 100
stopL = input.float(27.75, title = 'Stop Loss', group = 'Take Profit and Stop Loss')/100
// Pre Directionality
Stop_L = strategy.position_avg_price * (1 - stopL)
Stop_S = strategy.position_avg_price * (1 + stopL)
Take_S= strategy.position_avg_price * (1 - takeP)
Take_L = strategy.position_avg_price * (1 + takeP)
     
     
//Post Excecution
if strategy.position_size > 0
    strategy.exit("Close Long", limit=Take_L, stop = Stop_L)
if strategy.position_size < 0
    strategy.exit("Close Short", limit=Take_S, stop = Stop_S)
    
//Custom HLine Request
H1 = input.int( 75, 'Top Line', 51, 100, group = 'Top and Bottom Lines', inline = '1' )
H2 = input.int( 20, 'Bottom Line', 0, 49, group = 'Top and Bottom Lines', inline = '1' )
H3A = input.int(05, ' Transparancy of FIll', 1, 99, group = 'Top and Bottom Lines', inline = '1')
H3B = 100 - H3A
H1P = hline(H1, 'Top Line', #5BE14D, hline.style_dotted, 2, true )
H2P = hline(H2, 'Bottom Line', #E14D60, hline.style_dotted, 2, true )
fill(H1P, H2P, color.new(#E1CB5F,H3B), 'Line fills', editable = true ) 
Expand (639 lines)

Overview

PMAR and Madrid MA Strategy calculates PMAR or PMARP across selectable moving average types and a lookback window, plotting the resulting oscillator in a separate pane. Trades are executed using defined alert thresholds alongside configurable percentage-based take profit and stop loss levels.

Details

Published by

hasnocool on GitHub

Code credit

CheatCode1, as written in the script's header

Type

Strategy, Pine Script v5

Draws

Separate pane below the chart

Category

Moving averages, Oscillators & momentum, Scalping

Markets

Crypto

Timeframes

M1-M5, M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

analysisbtcusdtcryptocurrencydatapandaspythonsimulationtradingtradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Price sourcesourceclosei_src_price
Indicator....strings_pmarpi_p_type_line
PMAR lengthint20i_ma_len
MA type...stringVWMAi_ma_typ
Color typestringSpectrumi_c_typ_line
Spectrumstrings_BGRi_c_typ_spctrm_line
Solid colorcolor#FFFF00i_c_solid_line
Line widthint1i_p_width_line
Lookbackint350i_pmarp_lookback
Signal MAbooltruei_show_signal_ma
MA lengthint20i_signal_ma_Len
MA typestringSMAi_signal_ma_typ
Show all 30 settings
SettingTypeDefaultVariable
Color typestringSolidi_c_typ_sig
Spectrumstrings_BGRi_c_typ_spctrm_sig
Solid colorcolorcolor.whitei_c_solid_sig
Line widthint1i_p_width_sig
Hi PMARP alert levelfloat99i_hi_alert_pmarp
Lo PMARP alert levelfloat1i_lo_alert_pmarp
Hi PMAR alert level.float2.7i_hi_alert_pmar
Lo PMAR alert level.float0.7i_lo_alert_pmar
Hi alert line.booltruei_hi_alert_line_on
Lo alert line.booltruei_lo_alert_line_on
Hi signal barsbooltruei_bg_hi_signal_on
Lo signal barsbooltruei_bg_lo_signal_on
Expnential MAbooltruei_exp
Take Profitfloat1takeP
Stop Lossfloat27.75stopL
Top Lineint75H1
Bottom Lineint20H2
Transparancy of FIllint05H3A
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

BTC Futures MACD

by iamrichardD
57 stars

This strategy plots a MACD oscillator in a separate pane and trades Bitcoin futures from zero-line and signal-line crosses. Optional early momentum signals, a volume filter, and a trend moving-average filter can confirm entries. It sizes positions as fixed con

Strategy v6 Oscillators & momentumMoving averages Repaints
Updated 1 year ago · Apache-2.0 GitHub repository of BTC Futures MACD
53 stars

This strategy trades EUR/USD on the price chart using a fast and slow exponential moving average crossover filtered by RSI. It enters long when the fast EMA crosses above the slow EMA while RSI is above 50 and below the overbought level, and enters short on th

Strategy v6 TrendMoving averages
Updated 2 months ago · MPL-2.0 GitHub repository of EUR/USD EMA9-21 + RSI Scalping Strategy
13 stars

This strategy plots on the price chart and enters from a moving-average filter, ADX and Gann colours. Price above a 200-period EMA allows only longs; price below allows only shorts. A Gann aqua colour with ADX above a key level opens a long, and a Gann brown c

Strategy v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of Ruckard TradingZone ADX Gann
10 stars

The Reverse RSI Strategy is a scalping system designed for forex pairs during specific trading sessions. It combines a smoothed RSI indicator with five Exponential Moving Averages to identify mean-reversion trade opportunities. Position sizing dynamically adju

Strategy v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of Strategy - Reverse RSI

Scalping 3EMA

by rodrigo-brito
9 stars

This long-only strategy calculates three exponential moving averages with lengths of 50, 100, and 150 periods, plotting them directly on the price chart. It also calculates a 14-period RSI and MACD. The strategy opens long positions when the moving averages al

Strategy v4 TrendOscillators & momentum
Updated 5 years ago · MIT GitHub repository of Scalping 3EMA
330 stars

MACD + Divergences [Alorse] is a momentum strategy that calculates the MACD oscillator and identifies regular and hidden divergences using pivot high and low points. It filters trade signals with dual Exponential Moving Averages (EMA 150 and 600) to ensure tra

Strategy v4 Oscillators & momentumDivergence Repaints
Updated 2 months ago · None stated GitHub repository of MACD + Divergences [Alorse]

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers