Setup 123 Scalper
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
///\\===============================================================================//\\\
//████████╗██████╗  █████╗ ██████╗ ██╗███╗   ██╗ ██████╗ ██╗   ██╗██╗███████╗██╗    ██╗\\
//╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██║████╗  ██║██╔════╝ ██║   ██║██║██╔════╝██║    ██║\\
//   ██║   ██████╔╝███████║██║  ██║██║██╔██╗ ██║██║  ███╗██║   ██║██║█████╗  ██║ █╗ ██║\\
//   ██║   ██╔══██╗██╔══██║██║  ██║██║██║╚██╗██║██║   ██║╚██╗ ██╔╝██║██╔══╝  ██║███╗██║\\
//   ██║   ██║  ██║██║  ██║██████╔╝██║██║ ╚████║╚██████╔╝ ╚████╔╝ ██║███████╗╚███╔███╔╝\\
//   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝╚═╝  ╚═══╝ ╚═════╝   ╚═══╝  ╚═╝╚══════╝ ╚══╝╚══╝ \\
//\\==============================================================================//\\ \\
// ----------------------------------------------------------------------------------- \\
// Setup 123 Scalper: Developed by Cavuca-Trader                                       \\                                  
// ----------------------------------------------------------------------------------- \\
// ................................................................................... \\
// Name                  : Setup 123                                                   \\                                                  
// Surname               : Scalper                                                     \\                       
// Description           : Technical Analysis Setup Scalper                            \\
// Info                  : Setup for quick operations following the asset trend.       \\
// Creation Date         : 28/01/2023                                                  \\
// Version TradingView   : 5                                                           \\
// ................................................................................... \\
// v1.0 - release = TradingView = Ok                                                   \\
// v2.0 - correction of moving averages                                                \\
// v3.0 - corrected documentation                                                      \\
//=====================================================================================\\
// © Cavuca-Trader
// @version=5
indicator(title="Setup 123 Scalper", shorttitle="Setup-123", overlay=true)

// Creating var
var int sma1 = 9
var int sma2 = 21
var int sma3 = 200

// Creating moving averages
ma1 = ta.sma(close,sma1)
ma2 = ta.sma(close,sma2)
ma3 = ta.sma(close,sma3)

// Candle coloring rule scalper
Cwbar = close != open
Cgbar = ma1 > ma2 and high[2] > high[1] and high[1] < high[0] and low[2] > low[1] and low[1] < low[0]
Crbar = ma1 < ma2 and high[2] < high[1] and high[1] > high[0] and low[2] < low[1] and low[1] > low[0]

// Color of candles
barcolor(Cgbar ? color.green : na)
barcolor(Crbar ? color.red: na)
barcolor(Cwbar ? color.white : na)

// Moving average coloring 
m_col = color.gray
if ma1 > ma2
    m_col := color.rgb(7, 249, 15)   
if ma1 < ma2 
    m_col :=color.rgb(247, 8, 8)
    
// Moving average plots
plot(ma1,color = color.yellow,linewidth = 1)
plot(ma2,color = m_col,linewidth = 2)
plot(ma3,color = color.purple,linewidth = 3)