Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

Hour Final Afl 2019 for Amibroker (AFL)

Rating:
5 / 5 (Votes 1)
Tags:
amibroker hour 2019

_SECTION_BEGIN(“Price”);
SetChartBkColor( colorBlack );
//SetChartBkColor(ParamColor(“Outer panel”,colorBlack)); // color of outer border
SetChartBkGradientFill( ParamColor(“Inner panel upper”,colorBlack),ParamColor(“Inner panel lower”,colorBlack));
SetBarFillColor( IIf( C > O, ColorRGB( 0, 75, 0 ), IIf( C <= O, ColorRGB( 75, 0, 0 ), colorLightGrey ) ) );
Plot( C, "", IIf( C > O, ColorRGB( 0, 255, 0 ), IIf( C <= O, ColorRGB( 255, 0, 0 ), colorLightGrey ) ), 64, Null, Null, 0, 0, 1 );
_SECTION_END();

_SECTION_BEGIN(“Magnified Price”);
FS=Param(“Font Size”,19,11,100,1);
GfxSelectFont(“Times New Roman”, FS, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor(“Color”,colorWhite) );
Hor=Param(“Horizontal Position”,1131,1,1,1);
Ver=Param(“Vertical Position”,32,1,830,1);
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice(“C”,inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont(“Times New Roman”, 13, 700, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor(“Color”,colorYellow) );
GfxTextOut(""+DD+" (“xx”%)“, Hor , Ver+45 );
GfxTextOut(” Vol= "+V+"", Hor+100, Ver+45 );
_SECTION_END();

text = ParamToggle(“Plot Text”,“Off|On”,0);
//_SECTION_BEGIN(“Pivot”)
YH = TimeFrameGetPrice(“H”, inDaily, -1); // yesterdays high
YL = TimeFrameGetPrice(“L”, inDaily, -1); // low
YC = TimeFrameGetPrice(“C”, inDaily, -1); // close
YO = TimeFrameGetPrice(“O”, inDaily); // current day open

//Normal Pivot
PP = (YH + YL + YC) / 3;
R1 = (2 * PP) – YL;
R2 = PP + (YH – YL);
R3 = YH + 2*(PP-YL);
S1 = (2 * PP) – YH;
S2 = PP – (YH – YL);
S3 = YL – 2*(YH – PP) ;

GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorBlue, 3 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 300, 72, 395, 205, 100, 25 );
GfxSetBkMode(1);
GfxSelectFont( “Arial”, 9, 900, False );
GfxSetTextColor( colorWhite );
GfxSetTextAlign(0);
GfxTextOut( WriteIf(YH, "D.Piv.: “+(PP),”"), 305, 80);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(R1, "R1: “+(R1),”"), 312, 130);
GfxTextOut( WriteIf(R2, "R2: “+(R2),”"), 310, 115);
GfxTextOut( WriteIf(R3, "R3: “+(R3),”"), 310, 100);
GfxSetTextColor( colorLime );
GfxTextOut( WriteIf(S1, "S1: “+(S1),”"), 310, 150);
GfxTextOut( WriteIf(S2, "S2: “+(S2),”"), 310, 165);
GfxTextOut( WriteIf(S3, "S3: “+(S3),”"), 310, 180);

WYH = TimeFrameGetPrice(“H”, inWeekly, -1);
WYL = TimeFrameGetPrice(“L”, inWeekly, -1);
WYC = TimeFrameGetPrice(“C”, inWeekly, -1);
WYO = TimeFrameGetPrice(“O”, inWeekly);

//Week Pivot
WPP = (WYH + WYL + WYC) / 3;
WR1 = (2 * WPP) – WYL;
WR2 = WPP + (WYHWYL);
WR3 = WYH + 2*(WPP-WYL);
WS1 = (2 * WPP) – WYH;
WS2 = WPP – (WYHWYL);
WS3 = WYL – 2*(WYHWPP) ;

GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorBlue, 3 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect( 200, 72, 295, 205, 100, 25 );
GfxSetBkMode(1);
GfxSelectFont( “Arial”, 9, 900, False );
GfxSetTextColor( colorWhite );
GfxSetTextAlign(0);

GfxTextOut( WriteIf(YH, "W.Piv.: “+(WPP),”"), 205, 85);
GfxSetTextColor( colorRed );
GfxTextOut( WriteIf(R1, "R1: “+(WR1),”"), 210, 105);
GfxTextOut( WriteIf(R2, "R2: “+(WR2),”"), 210, 120);
GfxTextOut( WriteIf(R3, "R3: “+(WR3),”"), 210, 135);
GfxSetTextColor( colorLime );

GfxTextOut( WriteIf(S1, "S1: “+(WS1),”"), 210, 150);
GfxTextOut( WriteIf(S2, "S2: “+(WS2),”"), 210, 165);
GfxTextOut( WriteIf(S3, "S3: “+(WS3),”"), 210, 180);

_SECTION_BEGIN(“Auto PP”);
GraphXSpace = 5 ;
SetChartOptions(0,chartShowArrows|chartShowDates);

Plot(C,“Close”,colorBlack, styleCandle);
ppl = ParamToggle(“Plot Pivot Levels”,“Off|On”,1);

numbars = LastValue(Cum(Status(“barvisible”)));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
hts = -33.5;

/* This code calculates the previous days high, low and close */
Hi1 = IIf(Day()=Ref(Day(),-1),H,1),-1),0);
Hi = ValueWhen(Day()=Ref(Day(),-1),Ref(LowestSince(Day()=Ref(Day(),-1),Lo1,1);
Cl1 = IIf(Day()=Ref(Day(),-1),Cl1,1);

//—————————————————————————————————————————
/* This code calculates Daily Piovts */

rg = (Hi – Lo);
bp = (Hi + Lo + C1)/3; bpI = LastValue (bp,1);
r1 = (bp*2)-Lo; r1I = LastValue (r1,1);
s1 = (bp*2)-Hi; s1I = LastValue (s1,1);
r2 = bp + r1 – s1; r2I = LastValue (r2,1);
s2 = bp – r1 + s1; s2I = LastValue (s2,1);
r3 = bp + r2 – s1; r3I = LastValue (r3,1);
s3 = bp – r2 + s1; s3I = LastValue (s3,1);
r4 = bp + r2 – s2; r4I = LastValue (r4,1);
s4 = bp – r2 + s2; s4I = LastValue (s4,1);

if(ppl==1) {
//Plot(bp,"",colorGrey50,styleDots|styleDots|styleNoRescale);
/*Plot(s1,"",colorRed,styleLine|styleNoRescale);
Plot(s2,"",colorRed,styleLine|styleNoRescale);
Plot(s3,"",colorRed,styleLine|styleNoRescale);
Plot(s4,"",colorRed,styleLine|styleNoRescale);
Plot(r1,"",colorGreen,styleLine|styleNoRescale);
Plot(r2,"",colorGreen,styleLine|styleNoRescale);
Plot(r3,"",colorGreen,styleLine|styleNoRescale);
Plot(r4,"",colorGreen,styleLine|styleNoRescale);
*/
PlotText(" Pivot = " + WriteVal(bp,fraction), LastValue(BarIndex())-(numbars/Hts), bpI +0.05, colorBlue);
PlotText(" r1 = " + WriteVal(r1,fraction), LastValue(BarIndex())-(numbars/Hts), r1I +0.05, colorGreen);
PlotText(" s1 = " + WriteVal(s1,fraction), LastValue(BarIndex())-(numbars/Hts), s1I +0.05, colorRed);
PlotText(" r2 = " + WriteVal(r2,fraction), LastValue(BarIndex())-(numbars/Hts), r2I +0.05, colorGreen);
PlotText(" s2 = " + WriteVal(s2,fraction), LastValue(BarIndex())-(numbars/Hts), s2I +0.05, colorRed);
PlotText(" r3 = " + WriteVal(r3,fraction), LastValue(BarIndex())-(numbars/Hts), r3I +0.05, colorGreen);
PlotText(" s3 = " + WriteVal(s3,fraction), LastValue(BarIndex())-(numbars/Hts), s3I +0.05, colorRed);
PlotText(" r4 = " + WriteVal(r4,fraction), LastValue(BarIndex())-(numbars/Hts), r4I +0.05, colorGreen);
PlotText(" s4 = " + WriteVal(s4,fraction), LastValue(BarIndex())-(numbars/Hts), s4I +0.05, colorRed);
}
_SECTION_END();

_SECTION_BEGIN(“Background text”);
C13=Param(“fonts”,37,10,30,1 );
C14=Param(“left-right”,2.5,1.0,5.0,0.1 );
C15=Param(“up-down”,16,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(0);
GfxSelectFont(“Candara”, Status(“pxheight”)/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( Name(), Status(“pxwidth”)/C14, Status(“pxheight”)/C15 );
GfxSelectFont(“MS Sans Serif”, 10, 500, False, False, 0);
_SECTION_END();

_SECTION_BEGIN(“Previous Days High & Low”);

TimeFrameSet(inDaily);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

isAll = True;
isRth = TimeNum() >= 095500 AND TimeNum() <= 103000;
isdRth = TimeNum() >= 095500 AND TimeNum() <= 235900;

aRthL = IIf(isRth, L, 1000000);
aRthH = IIf(isdRth, H, Null);
aRthLd = IIf(isdRth, L, 1000000);

TOP = TimeFrameExpand(TOP_,inDaily,expandFirst);
PDH = TimeFrameExpand(PDH_,inDaily,expandFirst);
PDL = TimeFrameExpand(PDL_,inDaily,expandFirst);
PDO = TimeFrameExpand(PDO_,inDaily,expandFirst);
PDC = TimeFrameExpand(PDC_,inDaily,expandFirst);
PDM = TimeFrameExpand(PDM_,inDaily,expandFirst);
FHL = TimeFrameCompress( aRthL, inDaily, compressLow );
FHL = TimeFrameExpand( FHL, inDaily, expandFirst );
DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
DayL = TimeFrameExpand( DayL, inDaily, expandFirst );

function CDL
{
doy = DayOfYear();
Lastdoy = doy == LastValue( doy );
Dayline = array * Lastdoy;

return IIf( Dayline, Dayline, Null );

}

H1 = TimeFrameGetPrice( “H”, inDaily, -1 );
L1 = TimeFrameGetPrice( “L”, inDaily, -1 );
OPE = TimeFrameGetPrice(“O”, inDaily);
OPE1 = TimeFrameGetPrice(“O”, inDaily, -1 );
OC = TimeFrameGetPrice(“C”, inDaily, -1 );

Plot( cdl( H1 ), "", colorYellow, styleLine + styleDashed + styleNoRescale |styleNoLabel );

Plot( cdl( L1 ), "", colorWhite, styleDots + styleLine+ styleNoRescale |styleNoLabel );

Plot( cdl( OPE ), "", colorCustom12, styleThick + styleNoRescale );
//Plot( cdl( OPE ), "", colorCustom12, styleLine + styleDots + styleNoRescale |styleNoLabel);
//Plot( cdl( OPE1 ), "", colorCustom12, styleLine + styleDashed + styleNoRescale |styleNoLabel);

Plot( cdl( OC ), "", colorCustom4, styleLine + styleNoRescale |styleNoLabel);

_SECTION_END();

_SECTION_BEGIN(“5short signal”);
HaClose=(O+H+L+C)/4;
HaOpen = AMA, 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
BG2=HHV+ATR(4),8);
BR2=LLV-ATR,8);

k = Optimize(“K”,Param(“K”,3.5,1,5,0.25),1,5,0.25);

Per= Optimize(“atr”,Param(“atr”,13,3,30,1),3,30,1);
j=HaClose;
nm= (H-L);
rfsctor = WMA;
revers = K * rfsctor;
Trend = 1;
NW0 = 0;
for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(j[i] < NW[i-1])
{
Trend[i] = -1;
NW[i] = j[i] + Revers[i];
}
else
{
Trend[i] = 1;
if((j[i] – Revers[i]) > NW[i-1])
{
NW[i] = j[i] – Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
if(Trend[i-1] == -1)
{
if(j[i] > NW[i-1])
{
Trend[i] = 1;
NW[i] = j[i] – Revers[i];
}
else
{
Trend[i] = -1;
if((j[i] + Revers[i]) < NW[i-1])
{
NW[i] = j[i] + Revers[i];
}
else
{
NW[i] = NW[i-1];
}
}
}
}

Plot(NW, "", IIf(Trend == 1, 6, 4), 1 |styleNoRescale|styleLine|styleNoLabel );

Buy=Cross(j,nw);
Short=Cross(nw,j);
Sell=Cross(nw,j);
Cover=Cross(j,nw);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-50);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-60);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-55);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGold, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,Low,-15);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorYellow, 0,High,-15);
PlotShapes(IIf(Cover, shapeHollowCircle, shapeNone),colorWhite, 0,Close,0);
PlotShapes(IIf(Short, shapeHollowCircle, shapeNone),colorYellow, 0,Close,0);

AlertIf( Buy, “SOUND c:\\Windows\\Media\\chimes.wav”, “Buy alert”, 2 );
AlertIf( Sell, “SOUND c:\\Windows\\Media\\chimes.wav”, “Sell alert”, 3 );

Filter=Buy OR Short;
AddColumn( IIf( Buy, 66 , 83 ), “Signal”, formatChar, colorDefault, IIf( Buy , colorGreen, colorRed ) );
AddColumn(Close,“Entry Price”,1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(Ref(sell,-1),“Stop Loss”,1.4, colorDefault, IIf( Buy , colorGreen, colorRed ));
AddColumn(Volume,“Volume”,1.0, colorDefault, IIf ((Volume > 1.25 * EMA),colorBlue,colorYellow));

_SECTION_END();

_SECTION_BEGIN(“Title”);

DDayO = TimeFrameGetPrice(“O”, inDaily);
DHiDay = TimeFrameGetPrice(“H”, inDaily);
DLoDay = TimeFrameGetPrice(“L”, inDaily);
gfr = TimeFrameGetPrice(“C”, inDaily, -1);//close
O1 = SelectedValue( TimeFrameGetPrice( “open”, inDaily, 0 ) );

Title =" " + EncodeColor(55)+ Name() + " " + EncodeColor(colorAqua) + Date() + " " + EncodeColor(5) + "{{INTERVAL}} " + EncodeColor(colorBlue) " PreClose " + gfr + EncodeColor(colorRed)
+ " PreDayLow "
WriteVal(PDL,1)
EncodeColor(colorCustom12)" ToDay Open " DDayO
+ EncodeColor(colorRed)
" Low : “+ DLoDay
+EncodeColor(colorTurquoise) +” DayHi " DHiDay
+EncodeColor(colorRed)
EncodeColor(colorLightOrange)
+ " PreDayHigh "+WriteVal(PDH,1) + EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal(V,1);
_SECTION_END();

_SECTION_BEGIN(“DDTlines”);

DayO = TimeFrameGetPrice(“O”, inDaily); // current day open

Plot(MA, “200 bar MA”, colorRed, styleDashed,styleNoRescale);

Plot(EMA, “200 bar MA”, colorRed, styleLine,styleNoRescale);

Plot(EMA, “50 bar EMA”, colorLightBlue, styleThick,styleNoRescale);

_SECTION_END();

_SECTION_BEGIN(“Long MA”);
P = ParamField(“Price field”,3);
Periods = Param(“Periods”, 100, 2, 400, 1 );
Plot( MA, _DEFAULT_NAME(),colorLime, ParamStyle(“Style”, styleThick+styleDots ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN(“MA”);
P = ParamField(“Price field”,3);
Periods = Param(“Periods”, 13, 2, 200, 1 );
Plot( MA, _DEFAULT_NAME(), ParamColor( “Color”, colorCustom12), ParamStyle(“Style”, styleDashed ) | styleNoRescale |styleNoLabel);
_SECTION_END();

_SECTION_BEGIN(“Forecaster”);

//— Am I Smart— ???
// Modified from https://www.amibroker.com/library/detail.php?id=635
Ribbon1=IIf( EMA>EMA( Close ,34 ) ,colorBlue, IIf(EMA>EMA( Close , 13 ), colorRed,colorYellow));
Plot(1, “Ribbon”, Ribbon1, styleOwnScale| styleArea| styleNoLabel,-0.5,100);
_SECTION_END();

_SECTION_BEGIN(“BBands”);
P = ParamField(“Price field”,3);
Period = Param(“Short Periods”, 20, 15, 30, 1 );
Width = Param(“Short Width”, 2, 1, 10, 1 );

Periods = Param(“Periods”, 15, 2, 100, 1 );
Width = Param(“Width”, 2, 0, 10, 0.05 );
Color = ParamColor(“Color”, colorBlue );
Color = ColorBlend( Color, GetChartBkColor(), 0.1 );
Style = ParamStyle(“Style”, styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), “BBTop” + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), “BBBot” + _PARAM_VALUES(), Color, Style );
MidCond=MA>Ref(MA,-1);
Plot(MA,"",colorCustom13 ,styleDots+styleNoTitle+styleNoLabel+styleThick, Null, Null, Null, -1);
_SECTION_END();

/* ==============
onethat got away
*/

Screenshots

You cannot view the code for the following reasons:
  • The indicator has not yet been approved by the Administrator.

3 comments

1. hbkwarez

hour afl

2. niklravi

WHY THE ADMINISTARTER NOT APPROVED THE AFL? YET

RAVI

3. administrator

Looks like its just a combination of other formulas and has no description.

Leave Comment

Please login here to leave a comment.

Back