SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
SetChartBkColor(colorBlack) ;
SetBarFillColor( IIf( C >O AND C>MA(C,21) AND C>EMA(C,8),colorBlack, IIf( C <O AND C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C<O AND C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,IIf(( C>O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C>O AND C>MA(C,21) AND C<EMA(C,8)) ,colorBlack,IIf( C>O AND C<MA(C,21) AND C<EMA(C,8) ,colorBlack,colorRed) )))));
Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
black = C >O AND C>MA(C,21) AND C>EMA(C,8);
blue = C <O AND C>MA(C,21) AND C>EMA(C,8);
bb = black OR blue;
red = C <O AND C<MA(C,21) AND C<EMA(C,8);
Sell = Cross(red,bb);
Buy = Cross(bb,red);
Buyabove = High;
Buystop = Ref(Low,-2);
Sellbelow = Low;
Sellstop = Ref(High,-2);
sig = Buy OR Sell;
Filter = sig;
AddColumn(Sell,"sell");
AddColumn( Buy, "buy");
AddColumn(Buyabove,"buyabove",1.2,colorBlue);
AddColumn(Buystop,"buystop",1.2,colorBlue);
AddColumn(Sellbelow,"sellbelow",1.2,colorRed);
AddColumn(Sellstop,"sellstop",1.2,colorRed);
PlotShapes( shapeUpArrow*Buy, colorGreen,0, L, -20);
PlotShapes( shapeDownArrow*Sell, colorRed,0,H, -20) ;
_SECTION_BEGIN("MA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
SetChartBkColor(colorBlack) ;
SetBarFillColor( IIf( C >O AND C>MA(C,21) AND C>EMA(C,8),colorBlack, IIf( C <O AND C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C<O AND C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,IIf(( C>O AND C<MA(C,21) AND C>EMA(C,8)) OR ( C>O AND C>MA(C,21) AND C<EMA(C,8)) ,colorBlack,IIf( C>O AND C<MA(C,21) AND C<EMA(C,8) ,colorBlack,colorRed) )))));
Col=IIf( C<MA(C,21) AND C<EMA(C,8) ,colorRed,IIf( C>MA(C,21) AND C>EMA(C,8),colorBlueGrey,IIf(( C<MA(C,21) AND C>EMA(C,8)) OR ( C>MA(C,21) AND C<EMA(C,8)) ,colorYellow,colorYellow)));
Plot( C, "Close", col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
black = C >O AND C>MA(C,21) AND C>EMA(C,8);
blue = C <O AND C>MA(C,21) AND C>EMA(C,8);
bb = black OR blue;
red = C <O AND C<MA(C,21) AND C<EMA(C,8);
Sell = Cross(red,bb);
Buy = Cross(bb,red);
Buyabove = High;
Buystop = Ref(Low,-2);
Sellbelow = Low;
Sellstop = Ref(High,-2);
sig = Buy OR Sell;
Filter = sig;
AddColumn(Sell,"sell");
AddColumn( Buy, "buy");
AddColumn(Buyabove,"buyabove",1.2,colorBlue);
AddColumn(Buystop,"buystop",1.2,colorBlue);
AddColumn(Sellbelow,"sellbelow",1.2,colorRed);
AddColumn(Sellstop,"sellstop",1.2,colorRed);
PlotShapes( shapeUpArrow*Buy, colorGreen,0, L, -20);
PlotShapes( shapeDownArrow*Sell, colorRed,0,H, -20) ;
_SECTION_BEGIN("MA2");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();