// Downloaded From https://www.WiseStockTrader.com
_SECTION_BEGIN("Background Color");
BKswitch = ParamToggle("Background Color","On,Off");
 
OUTcolor =colorBlack;// ParamColor("Outer Panel Color",colorBlack);
INUPcolor =colorBlack;// ParamColor("Inner Panel Upper",colorBlack);
INDNcolor =colorBlack;// ParamColor("Inner Panel Lower",colorBlack);
TitleColor =colorBlack;// ParamColor("Title Color ",colorBlack);
 
if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}
_SECTION_END();

_SECTION_BEGIN("Parameter Color");
Line1=17;//ParamColor("Line Yancedolly Bands Medium Cycle Color",17);
Line2=6;//ParamColor("Line Yancedolly Bands Short Cycle Color",6);
Line3=9;//ParamColor("Line Floor Top Color",9);
Vol1=colorDarkGreen;//ParamColor("Vol Up Color",colorDarkGreen);
Vol2=colorDarkRed;//ParamColor("Vol Down Color",colorDarkRed);
Vol3=23;//ParamColor("Vol Avarage Color",23);
price1=colorRose;//ParamColor("Price Color",colorRose);
price2=colorBrightGreen;//ParamColor("Price Down Color",colorBrightGreen);
price3=colorRed;//ParamColor("Price Up Color",colorRed);
_SECTION_END();

_SECTION_BEGIN("Volume");
if (NOT ParamToggle("Volume Switch","On,Off"))
{
Plot( Volume, _DEFAULT_NAME(), IIf( C > O, Vol1, Vol2), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram  ), 2 );
Plot(MA(Volume,Param("MA Periods",5,5,50,1)),"",Vol3,styleLine |styleOwnScale ,Param("Scale",5,1,20,1));
}
_SECTION_END();

_SECTION_BEGIN("Yancedolly Bands");

hcl=(O+H+L+C)/4;
Ho=AMA(Ref(hcl,-1),0.5);
HH=Max(H,Max(hcl,Ho));
HL=Min(L,Min(hcl,Ho));

//trader = (hcl-Ho);
trader = (hcl);
VarRedLine = WMA(trader,5);
VarBlueLine = MA(trader,8);
Per =15;// Param("MA Periods",15,3,50,1);
//Plot(trader,"trader",colorDarkRed);
thick=0.5;//Param("thickness",0.5,0.01,5,0.01);
 
//P = ParamField("Price field",-1);
HDCPeriods = per;
//Width = Param("Width", 2, 0, 10, 0.05 );
//Color = ParamColor("Color", colorCycle );
//Style = ParamStyle("Style");
bbbot = BBandBot( trader, HDCPeriods, 2 );
bbc=MA(trader,HDCPeriods);
bbtop = BBandTop( trader, HDCPeriods, 2 );
//Plot( bbtop, "bbtop" , Line3, 1 );
//Plot( bbc, "bbc" , Line3, 1 );
//Plot( bbbot, "bbbot" , Line3, 1 );

//----------------------------------------------------


//BBLength= Param("BBLength",10,2,30,2);
//StdDv= Param("Stdev",2,0.5,5,0.1);
//UpB=BBandTop(H,BBLength,StdDv);
//Mdb=MA(C, BBLength);
//DnB=BBandBot(L,BBLength,StdDv);

K1=5;// Param("EMA Periods?",5,3,50);
K2=10;// Param("ATR Periods?",10,2,50);
Mul=1;//Param("ATR Multiplier?",1,0.5,5,0.5);
Mi=EMA(C, K1);
Kel= ATR(K2)*Mul;
UB= Mi + Kel;
LB= Mi - Kel;

CY2 =80/2;//  Param("Medium Cycle Length?" ,80, 1 ,1000 ,1 )/2;
M2 = 3;// Param("Medium Cycle Multiplyer?" ,3, 0.01 ,10 ,1 );
UpY=EMA(C, CY2)+M2*ATR(CY2);
MdY=EMA(C, CY2);
DnY=EMA(C, CY2)-M2*ATR(CY2);


UpperBand4 =EMA( C, CY2) + ( 6.8540 * ATR(CY2));
UpperBand3 =EMA( C, CY2) + ( 4.2360 * ATR(CY2));
UpperBand2=EMA( C, CY2) +  ( 2.6180 * ATR(CY2));
UpperBand1=EMA( C, CY2) +  ( 1.6180 * ATR(CY2));
 
MidPoint=EMA(C, CY2);
 
LowerBand1=EMA( C, CY2) - ( 1.6180 * ATR(CY2));
LowerBand2=EMA( C, CY2) - ( 2.6180 * ATR(CY2));
LowerBand3=EMA( C, CY2) - ( 4.2360 * ATR(CY2));
LowerBand4=EMA( C, CY2) - ( 6.8540 * ATR(CY2));

if (NOT ParamToggle("Yancedolly Bands Info","On,Off"))
{ 
Plot( bbtop, "bbtop" , Line3, 1 );
Plot( bbc, "bbc" , Line3, 1 );
Plot( bbbot, "bbbot" , Line3, 1 ); 
Plot(UpperBand4,"UpperBand4",colorDarkTeal,1);
Plot(UpperBand3,"UpperBand3",colorDarkGrey,1);
Plot(UpperBand2,"UpperBand2",colorDarkRed,1);
Plot(UpperBand1,"UpperBand1",colorViolet,1);
Plot(MidPoint,"MidPoint",colorDarkGreen,4);
Plot(LowerBand1,"LowerBand1",colorViolet,1);
Plot(LowerBand2,"LowerBand2",colorDarkRed,1);
Plot(LowerBand3,"LowerBand3",colorDarkGrey,1);
Plot(LowerBand4,"LowerBand4",colorDarkTeal,1);
Plot (UB,"UB",Line2,1);
Plot (LB,"LB",Line2,1);
}else
{
Plot( bbtop, "" , Line3, 1 );
Plot( bbc, "" , Line3, 1 );
Plot( bbbot, "" , Line3, 1 ); 
Plot(UpperBand4,"",colorDarkTeal,1);
Plot(UpperBand3,"",colorDarkGrey,1);
Plot(UpperBand2,"",colorDarkRed,1);
Plot(UpperBand1,"",colorViolet,1);
Plot(MidPoint,"",colorDarkGreen,4);
Plot(LowerBand1,"",colorViolet,1);
Plot(LowerBand2,"",colorDarkRed,1);
Plot(LowerBand3,"",colorDarkGrey,1);
Plot(LowerBand4,"",colorDarkTeal,1);
Plot (UB,"",Line2,1);
Plot (LB,"",Line2,1);
}
//Plot (Close, "close",1,64);
//Plot (Mi,"",Line2,1);
//Plot (UB,"UB",Line2,1);
//Plot (LB,"LB",Line2,1);
//Plot(UpB,"",2,1);
//Plot(MdB,"",2,1);
//Plot(DnB,"",2,1);
//Plot(UpY,"UpY",Line1,1);
//Plot(MdY,"MdY",Line1,1);
//Plot(DnY,"DnY",Line1,1);

_SECTION_END();


_SECTION_BEGIN( "Price" );
GraphXSpace = 5;
SetChartOptions( 0, chartShowDates | chartShowArrows | chartLogarithmic | chartWrapTitle );
_N( Title = StrFormat( "{{NAME}} - " + SectorID( 1 ) + " - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal( V, 1.0 ) + " {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
Plot( C, "Close", IIf(L<=LB,price2,IIf(H>=UB,price3,price1)), styleCandle | styleNoTitle | ParamStyle( "Style" ) | GetPriceStyle() );
 
if ( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) )
{
    ToolTip = StrFormat( "Open: %g\nHigh:  %g\nLow:   %g\nClose:  %g (%.1f%%)\nVolume: " + NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
}
_SECTION_END();

_SECTION_BEGIN("Smooth CCI 14-7");
///// Smooth CCI //////
x=14;
Y=7;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_14_7 = Cross(x1,Y2);
Sell_14_7 = Cross(Y2,x1);
Buy_14_7=ExRem(Buy_14_7,Sell_14_7); Sell_14_7=ExRem(Sell_14_7,Buy_14_7);
//====================================================================================================================================
_SECTION_END();

_SECTION_BEGIN("Smooth CCI 12-6");
///// Smooth CCI //////
x=12;
Y=6;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_12_6 = Cross(x1,Y2);
Sell_12_6 = Cross(Y2,x1);
Buy_12_6=ExRem(Buy_12_6,Sell_12_6); Sell_12_6=ExRem(Sell_12_6,Buy_12_6);
//====================================================================================================================================
_SECTION_END();

_SECTION_BEGIN("Smooth CCI 10-5");
///// Smooth CCI //////
x=10;
Y=5;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_10_5 = Cross(x1,Y2);
Sell_10_5 = Cross(Y2,x1);
Buy_10_5=ExRem(Buy_10_5,Sell_10_5); Sell_10_5=ExRem(Sell_10_5,Buy_10_5);
//====================================================================================================================================
_SECTION_END();

_SECTION_BEGIN("Smooth CCI 8-4");
///// Smooth CCI //////
x=8;
Y=4;
x1=CCI(x);
Y2=DEMA(x1,Y);
Z=3;//Param("Signal Line 3 - 9",3,3,9,1);
Z2=MA(Y2,Z);
//====================================================================================================================================
Buy_8_4 = Cross(x1,Y2);
Sell_8_4 = Cross(Y2,x1);
Buy_8_4=ExRem(Buy_8_4,Sell_8_4); Sell_8_4=ExRem(Sell_8_4,Buy_8_4);
//====================================================================================================================================
_SECTION_END(); 

_SECTION_BEGIN("ATR Trading System");
  k=1; /* multiplication factor*/
  n=10; /*period*/
  f=ATR(n);
     
 
    R[0] = Close[0];
 
    S[0] = C[0];
for( i = 11; i < BarCount; i++ )
{
 
 
   R[i]=R[i-1];
   S[i]=S[i-1];
 
    if ( C[i-1] >R[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
}  
    if ( C[i-1] <S[i-1] )
{
       r[i] = C[i-1]+k*f[i-1];
       s[i]= C[i-1]-k*f[i-1];
}
 
 
//Buy=Close>R;
//Sell=Close<S;

Cump=IIf(Close>R,1,0);
Vanz=IIf(Close<S,1,0);
}
_SECTION_END(); 

_SECTION_BEGIN("Yancedolly Bands All in One");
if (ParamToggle("Smooth CCI Switch","On,Off"))
{
PlotShapes( Buy_14_7 * shapeUpArrow, colorGreen,0, L, -10);
PlotShapes( Sell_14_7 * shapeDownArrow, colorGreen,0, H, -10);
PlotShapes( Buy_12_6 * shapeUpArrow, colorViolet,0, L, -15);
PlotShapes( Sell_12_6 * shapeDownArrow, colorViolet,0, H, -15);
PlotShapes( Buy_10_5 * shapeUpArrow, colorRed,0, L, -20);
PlotShapes( Sell_10_5 * shapeDownArrow, colorRed,0, H, -20);
PlotShapes( Buy_8_4 * shapeUpArrow, colorTeal,0, L, -25);
PlotShapes( Sell_8_4 * shapeDownArrow, colorTeal,0, H, -25);
}
if (ParamToggle("ATR Trading System Switch","On,Off"))
{
PlotShapes( IIf(Cump, shapeSmallCircle,shapeNone), 5,0, L, -15);
PlotShapes(IIf( Vanz,shapeSmallCircle,shapeNone), 11,0, H, 15);
}
Filter = Buy_14_7 OR Sell_14_7 OR Buy_12_6 OR Sell_12_6 OR Buy_10_5 OR Sell_10_5 OR Buy_8_4 OR Sell_8_4;
//Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
AddTextColumn(FullName(),"Name");
AddColumn( Buy_14_7, "BUY_14_7",1.0,colorDefault,IIf(Buy_14_7,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_14_7, "SELL_14_7",1.0,colorDefault,IIf(Sell_14_7,colorRed,colorDefault),colorDefault);
AddColumn( Buy_12_6, "BUY_12_6",1.0,colorDefault,IIf(Buy_12_6,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_12_6, "SELL_12_6",1.0,colorDefault,IIf(Sell_12_6,colorRed,colorDefault),colorDefault);
AddColumn( Buy_10_5, "BUY_10_5",1.0,colorDefault,IIf(Buy_10_5,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_10_5, "SELL_10_5",1.0,colorDefault,IIf(Sell_10_5,colorRed,colorDefault),colorDefault);
AddColumn( Buy_8_4, "BUY_8_4",1.0,colorDefault,IIf(Buy_8_4,colorGreen,colorDefault),colorDefault);
AddColumn( Sell_8_4, "SELL_8_4",1.0,colorDefault,IIf(Sell_8_4,colorRed,colorDefault),colorDefault);
_SECTION_END();