//_SECTION_BEGIN("Bad-Screen");
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 ) ) ));
//////////// Candlestick, OBV et MA20,50,100 et 200 sur Time Frame Inférieur a DAILY
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot(MA(C,20),"MA20",colorCustom12,styleLine);
Plot(MA(C,50),"MA50",colorRed,styleLine);
Plot(MA(C,100),"MA10",colorBlue,styleLine);
IIf(Interval()<85000,
Plot(MA(C,200),"MA200",colorBlack,styleLine), 0 );
Plot(OBV(),"OBV",colorTurquoise,styleLine|styleThick|styleOwnScale);
///// SECTION_BEGIN("B/S MA20-50") //////////////////////////
DMa20= DEMA(C,20) ;
DMa50= DEMA(C,50) ;
Ma20= MA( C, 20 );
Ma50= MA( C, 50 );
CrMaH= BarsSince(Cross(MA20,MA50))<25 AND MA20>MA50 ;
CrMaB= BarsSince(Cross(MA50,MA20))< 25 AND MA20<MA50 ;
St= StochK(9,3) ;
MSt= StochD(9,3,3) ;
CrStH= Cross(St,MSt) AND (LLV(St,3)<60) ;
CrStB= Cross(St,MSt) AND (LLV(St,3)>40);
// Use CrossMacd in 15 min. with B/S in 5 min.
CrMacdH= BarsSince(Cross(MACD(),Signal()))< 12 AND MACD()>Signal() ;
CrMacdB= BarsSince(Cross(Signal(),MACD()))< 12 AND Signal()>MACD() ;
Buy_MA= CrMaH AND CrStH ;
Sell_MA= CrMaB AND CrStB ;
PlotShapes(Buy_MA*shapeUpArrow,colorBlue,0,L,-20);
PlotShapes(Sell_MA*shapeDownArrow,colorRed,0,H,-20);
///// _SECTION_BEGIN("trend MA 20-50") ////////////
uptrend= Ma20>Ma50 OR DMa20>DMa50 ;
downtrend= Ma20<Ma50 OR DMa20<DMa50 ;
Plot( 2, /* defines the height of the ribbon in percent of pane width */"\nribbon",
IIf( uptrend, colorBlue, IIf( downtrend, colorCustom12, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
//////// SECTION_BEGIN("Buy H/B 10-20-Intra Day"); ////////////
Haut= IIf(Interval()==3600, Ref(HHV(C,20),-1),
IIf(Interval()==1800, Ref(HHV(C,40),-1),
IIf(Interval()==900, Ref(HHV(C,80),-1),0 ))) ;
Bas= IIf(Interval()==3600, Ref(LLV(C,10),-1),
IIf(Interval()==1800, Ref(LLV(C,20),-1),
IIf(Interval()==900, Ref(LLV(C,40),-1),0 ))) ;
Plot(Haut,"HautP",colorBlue,styleLine);
Plot(Bas,"BasP",colorRed,styleLine);
//_SECTION_END();