Sunday, 31 August 2014
Buy Sell Signals given for signals to signal tread.Trend Indicator for Amibroker (AFL)
Buy Sell Signals given for signals to signal tread.
Trend Indicator for Amibroker (AFL)
_SECTION_BEGIN("Price");
pds = 20;
MAFAST = EMA( Close, 20 );
MASLOW = EMA( Close, 40 );
DonchianUpper = HHV( Ref( H, -1 ), pds );
DonchianLower = LLV( Ref( L, -1 ), pds );
DonchianMiddle = ( DonchianUpper + DonchianLower ) / 2;
UpTrend = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) ) AND EMA( Close, 20 ) > EMA( Close, 40 );
DnTrend = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) ) AND EMA( Close, 20 ) < EMA( Close, 40 );
Color = IIf( UpTrend, colorGreen, IIf( DnTrend, colorRed, colorBlue) );
UpTrend=ExRem(UpTrend,DnTrend);
Dntrend=ExRem(DnTrend,UpTrend);
Plot( C, "Price", Color, styleBar | styleThick );
NewDay = IIf(Day() != Ref(Day(), -1) OR BarIndex() == LastValue(BarIndex()), 1, 0);
_SECTION_END();
PlotShapes(IIf(UpTrend, shapeUpArrow, shapeNone),colorBrightGreen, 0,L, Offset=-45);
PlotShapes(IIf(DnTrend, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-45);
_SECTION_BEGIN("L.T.P.");
cx = Param( "cxposn", 1000, 0, 1250, 1 );
cy = Param( "cyposn", 25, 0, 500, 1 );
GfxSelectFont( "Candara", 18, 98, False );
gfxcup = SelectedValue(C > Ref(C,-1));
gfxpcolor = IIf(gfxcup,colorBrightGreen,colorRed);
GfxSetTextColor(gfxpcolor);
//GfxSetTextColor( colorWhite );
GfxTextOut( "L.T.P. " + C + " ", cx, cy );
_SECTION_END();
_SECTION_BEGIN("Background text");
SetChartBkColor(colorBlack);
strWeekday = StrMid("---sunday---Monday--TuesdayWednesday-Thursday--Friday--Saturday", SelectedValue(DayOfWeek())*9,9);
GraphXSpace=Param("GraphXSpace",0,-55,200,1);
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");
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Candara", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxTextOut( "By", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );
GfxSelectFont("Candara", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (103,103,103));
GfxTextOut( "Otithi Lozz", Status("pxwidth")/C14, Status("pxheight")/C15*4 );
GfxSelectFont("MS Sans Serif", 10, 500, False, False, 0);
_SECTION_END();
_SECTION_BEGIN("Title");
DODay = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);
Title = EncodeColor(colorWhite)+" Otithi "+EncodeColor(colorWhite)+ Name() + ", " + Interval(2) + ", " + Date() + " - "+strWeekday + " - " +
EncodeColor(colorWhite) + "\nO " + EncodeColor(colorWhite) + O +
", H : " + H +
", L : " + L +
", C : " + C +
"\n"+EncodeColor(colorWhite)+ " Day-Open : " +DODay + " Day-High : " +DHiDay + " Day-Low : " + DLoDay
;
_SECTION_BEGIN("Time Left");
function GetSecondNum()
{
Time = Now( 4 );
Seconds = int( Time % 100 );
Minutes = int( Time / 100 % 100 );
Hours = int( Time / 10000 % 100 );
SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
return SecondNum;
}
RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;
x=Param("xposn",430,0,1000,1);
y=Param("yposn",40,0,1000,1);
GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
{
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 );
Say( "New period" );
}
cx = Param( "cxposn", 1080, 0, 1250, 1 );
cy = Param( "cyposn", 5, 0, 500, 1 );
GfxSelectFont( "Candara", 14, 98, False );
GfxSetTextColor(colorBlue);
GfxTextOut( "T i m e L e f t " + SecsToGo + " ", cx, cy );
_SECTION_END();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Thanks