Sunday 14 September 2014

Entry Signal, colorBlue, ExitSignal, colorRed, for Amibroker (AFL)

Entry Signal, colorBlue, ExitSignal, colorRed, for Amibroker (AFL)






_SECTION_BEGIN("Price");
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() );
_SECTION_END();
SetChartBkColor(ParamColor("Outer panel color ",colorLightYellow));
SetChartBkColor(ParamColor("BackGround Color", colorDarkGrey));

Wilders1 = Wilders(H,3);
Wilders2 = Wilders(L,3);
Wilders3 = Wilders(C,3);

Plot( Wilders1, "EMA1" ,ParamColor( "Color1", colorRed ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
Plot( Wilders2, "EMA2" ,ParamColor( "Color2", colorGreen ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
Plot( Wilders3, "EMA3" ,ParamColor( "Color3", colorBlue ), ParamStyle("Style", styleDashed|styleThick) | styleNoRescale );
TimeFrameSet(inHourly);
DayHigh = LastValue(H);
DayLow = LastValue(L);
TimeFrameRestore();

SetChartOptions(0,chartShowArrows|chartShowDates);
Title = EncodeColor(colorYellow)+ Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorSkyblue) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Open-"+O+"  "+"High-"+H+"  "+"Low-"+L+"  "+"Close-"+C+"  "+ "Volume= "+ WriteVal(V);



P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( Wilders( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );

C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");


SetChartOptions(0,chartShowArrows|chartShowDates);
Title = EncodeColor(colorYellow)+ Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorSkyblue) +
 "  - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Open-"+O+"  "+"High-"+H+"  "+"Low-"+L+"  "+"Close-"+C+"  "+ "Volume= "+ WriteVal(V);




EntrySignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
ExitSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) );

Color = IIf( EntrySignal, colorBlue, IIf( ExitSignal, colorRed, colorGrey50 ));


Plot( C, "Price", Color, styleCandle | styleThick );

Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, -0.1, 50 );

GfxSetBkMode( 1 );
GfxSelectFont("Tahoma", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));

GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));

GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));

GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);

No comments:

Post a Comment

Thanks