Trendscore

#1
I tried to write Trendscore trend indicator used to set the interval of 15 min


// Trendscore 30
_SECTION_BEGIN("Lines");
MaxGraph=30;

Line_up = Param("line_up", 25,1,40);
Plot( Line_up, "",ParamColor("Line_up Color",1),ParamStyle("Line_up",styleNoLabel+styleThick));

Line_zero=Param("line_zero",0,-2,2);
Plot(Line_zero,"", ParamColor("line_zero Color",4),ParamStyle("Line_zero",styleNoLabel+styleThick));

Line_down = Param("line_down", -25,-40,0);

Plot( Line_down, "",ParamColor("Line_down Color",1),ParamStyle("Line_down",styleNoLabel+styleThick));

Title = EncodeColor(colorBlue)+ "Trendscore" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorBlue) +
" - " + Date() +" - " +EncodeColor(colorLime)+"Volume= "+WriteVal(V)+" - " +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+"Cl-"+C+" ";


_SECTION_END();

_SECTION_BEGIN("Trend");
GraphXSpace = 20;

Graph1Style=4;
Graph1Color=(colorBlue);


Graph1=
IIf (C > Ref(C,-11),1,-1) +
IIf (C > Ref(C,-12),1,-1) +
IIf (C > Ref(C,-13),1,-1) +
IIf (C > Ref(C,-14),1,-1) +
IIf (C > Ref(C,-15),1,-1) +
IIf (C > Ref(C,-16),1,-1) +
IIf (C > Ref(C,-17),1,-1) +
IIf (C > Ref(C,-18),1,-1) +
IIf (C > Ref(C,-19),1,-1) +
IIf (C > Ref(C,-20),1,-1) +
IIf (C > Ref(C,-21),1,-1) +
IIf (C > Ref(C,-22),1,-1) +
IIf (C > Ref(C,-23),1,-1) +
IIf (C > Ref(C,-24),1,-1) +
IIf (C > Ref(C,-25),1,-1) +
IIf (C > Ref(C,-26),1,-1) +
IIf (C > Ref(C,-27),1,-1) +
IIf (C > Ref(C,-28),1,-1) +
IIf (C > Ref(C,-29),1,-1) +
IIf (C > Ref(C,-30),1,-1) +
IIf (C > Ref(C,-31),1,-1) +
IIf (C > Ref(C,-32),1,-1) +
IIf (C > Ref(C,-33),1,-1) +
IIf (C > Ref(C,-34),1,-1) +
IIf (C > Ref(C,-35),1,-1) +
IIf (C > Ref(C,-36),1,-1) +
IIf (C > Ref(C,-37),1,-1) +
IIf (C > Ref(C,-38),1,-1) +
IIf (C > Ref(C,-39),1,-1) +
IIf (C > Ref(C,-40),1,-1) ;

Buy=Cross(Graph1,Graph1>0);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone) ,colorGreen);
Sell=Cross(Graph1>0,Graph1);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed);



_SECTION_END();

_SECTION_BEGIN("Fill Color");
Fillswitch = ParamToggle("Fill Color1","On,Off");

FillColor = IIf( Graph1 > 25 OR Graph1< -25, ParamColor("Up Fill Color1",colorGreen),ParamColor("Down Fill Color1", colorGreen));

PlotOHLC(Graph1,Graph1,25,Graph1, "", FillColor, styleNoLabel | styleCloud | styleClipMinMax, Line_down, Line_up);


_SECTION_END();

Day interval is used for setting:

Graph1=
IIf (C > Ref(C,-11),1,-1) +
IIf (C > Ref(C,-12),1,-1) +
IIf (C > Ref(C,-13),1,-1) +
IIf (C > Ref(C,-14),1,-1) +
IIf (C > Ref(C,-15),1,-1) +
IIf (C > Ref(C,-16),1,-1) +
IIf (C > Ref(C,-17),1,-1) +
IIf (C > Ref(C,-18),1,-1) +
IIf (C > Ref(C,-19),1,-1) +
IIf (C > Ref(C,-20),1,-1) ;

I'm not an expert in the AFL - I'm learning :!

p.s.
sorry for my English is not the best:confused: