Hi,
can some one help me to understand this afl and how to use it effectivily
can some one help me to understand this afl and how to use it effectivily
Code:
/*
Dedicated to Obrolan Bandar & AmiBroker Indonesia
By Timur Langit......
May 2010
Dibantu oleh Eko Widjajanto dan Irwan
*/
SetChartOptions( 0, chartShowArrows|chartShowDates );
_SECTION_BEGIN("BW Buaya Lucu & Seru Timur Langit");
//SetChartBkGradientFill( colorWhite,colorWhite,colorWhite);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Close %g {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
PriceStyle = GetPriceStyle();
PriceStyleOpt = ParamStyle("Price Style")|PriceStyle;
if (PriceStyle==styleCandle)
Plot( C, "Buaya Lucu & Seru Timur Langit", colorAqua, PriceStyleOpt);
else
Plot( C, "Buaya Lucu & Seru Timur Langit", IIf( Close >= Ref(C, -1), colorBrightGreen, colorRed ),
PriceStyleOpt);
percentChange = 3;
ZZ = Zig(C,LastValue(PercentChange)) ;
Plot(ZZ,"", colorBlue,styleLine|styleThick| styleNoLabel);
Plot(ZZ*0.9997,"", colorBlue,styleLine|styleThick| styleNoLabel);
Plot(ZZ*1.0003,"", colorBlue,styleLine|styleThick| styleNoLabel);
PivotLow = Ref(IIf(Ref(ROC(ZZ,1),-1) < 0 AND ROC(ZZ,1) > 0, 1, Null),1);
PivotHigh = Ref(IIf(Ref(ROC(ZZ,1),-1) > 0 AND ROC(ZZ,1) < 0, 1, Null),1);
PlotShapes( IIf(PivotLow,shapeCircle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(PivotHigh,shapeCircle,0) ,colorCustom12, 0, H,12);
zbuy = pivotlow;
zsell= pivothigh;
//Plot( EMA( C, 100 ), "EMA100", colorOrange, styleThick);
//Plot( EMA( C, 200 ), "EMA200", colorCustom12, styleThick);
//Plot( 0.999*EMA( C, 100 ), "", colorOrange, styleThick | styleNoLabel);
//Plot( 0.999*EMA( C, 200 ), "", colorCustom12, styleThick | styleNoLabel);
//Plot( 1.001*EMA( C, 100 ), "", colorOrange, styleThick | styleNoLabel);
//Plot( 1.001*EMA( C, 200 ), "", colorCustom12, styleThick | styleNoLabel);
A = (H+L)/2;
SlowMA=MA( A,34);
FastMA=MA( A,5);
AO=FastMA-SlowMA;
UpColor=AO >= Ref(AO,-1);
DnColor=AO < Ref(AO,-1);
UpFractal= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));
DownFractal= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));
UpFractalMax = Max(HHV(H,3),Ref(UpFractal,2));
DownFractalMin = Min(LLV(L,3),Ref(DownFractal,2));
Plot(UpFractalMax, "BF" ,33, styleThick);
Plot(DownFractalMin, "SF",11, styleThick);
PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorBlue, 0, L,-2);
PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(AO>0 AND C<Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(AO>0 AND C<Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorBlack, 0, H,2);
PlotShapes( IIf(AO<0 AND C<Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(AO<0 AND C<Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorBlack, 0, H,2);
j50 = DownFractalMin>Ref(DownFractalMin,-1); // tambah luagi
j51 = AO<0 AND C<Ref(DownFractalMin,-1) OR AO>0 AND C<Ref(DownFractalMin,-1) ;
AlertIf( DownFractalMin>Ref(DownFractalMin,-1), "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Copet.WAV", "Audio alert", 2 );
AlertIf( AO<0 AND C<Ref(DownFractalMin,-1) OR AO>0 AND C<Ref(DownFractalMin,-1), "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\AmbilUntung.wav", "Audio alert", 2 );
AlligatorJaw = Ref(Wilders(A,13),-8);
AlligatorTeeth = Ref(Wilders(A,8), -5);
AlligatorLips = Ref(Wilders(A,5), -3);
Plot(AlligatorJaw, "", colorBlue, styleThick | styleNoLabel);
Plot(AlligatorTeeth,"", colorRed, styleThick | styleNoLabel);
Plot(AlligatorLips, "", colorDarkGreen,styleThick | styleNoLabel);
PlotOHLC( C,C,AlligatorLips,AlligatorLips, "", IIf(C>AlligatorLips,colorLime,colorRed), styleCloud| styleNoLabel);
PlotOHLC( AlligatorLips,AlligatorLips,AlligatorJaw,Alligator Jaw, "", IIf(AlligatorLips>AlligatorJaw,colorYellow,colorPi nk), styleCloud| styleNoLabel);
Buy= Cross(C,AlligatorLips);
Sell=Cross(AlligatorLips,C);
myStochD=StochD( 14 , 34, 8 );
myStochK=StochK( 14 , 34);
BuySto = Cross(myStochK, myStochD );
SellSto = Cross( myStochD, myStochK );
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
r4 = Param( "Wk slow", 8, 2, 200, 1 );
r5 = Param( "Wk fast", 17, 2, 200, 1 );
m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);
M0=IIf(AO<-120,IIf(AO>Ref(AO,-1) AND Ref(AO,-1)<Ref(AO,-2),1,0),0);
PlotShapes( IIf(M0,shapeSmallCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(M0,shapeHollowCircle,0) ,colorDarkGreen, 0, L,-2);
AlertIf( M0, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Copet.WAV", "Audio alert", 2 );
R3a=Cross(m1,s1) AND m1<0;
PlotShapes(IIf(R3a,shapeCircle ,Null),colorBlack,0,L,-30);
PlotShapes(IIf(R3a,shapeDigit0 ,Null),colorWhite,0,L,-30);
PlotShapes(IIf(R3a,shapeUpArrow,Null),colorWhite,0 ,L,-15);
H1=Cross(AO,0);
PlotShapes(IIf(H1,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(H1,shapeDigit1 ,0) ,colorGold, 0, L,-45);
PlotShapes(IIf(H1,shapeUpArrow ,0) ,colorGold, 0, L,-30);
A00=IIf(AO<0,IIf(BuySto,1,0),0);
PlotShapes( IIf(A00,shapeSmallCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(A00,shapeHollowCircle,0) ,colorDarkGreen, 0, L,-2);
AlertIf( A00, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Copet.WAV", "Audio alert", 2 );
Z01=IIf(AO>0,IIf(SellSto,1,0),0);
PlotShapes( IIf(Z01,shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(Z01,shapeHollowCircle,0) ,colorBlack, 0, H,2);
AlertIf( Z01, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\AmbilUntung.wav", "Audio alert", 2 );
A11=IIf(AO>120,IIf(AO<Ref(AO,-1) AND Ref(AO,-1)>Ref(AO,-2),1,0),0);
PlotShapes( IIf(A11,shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(A11,shapeHollowCircle,0) ,colorBlack, 0, H,2);
AlertIf( A11, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Copet.WAV", "Audio alert", 2 );
I2=Cross(m1,s1) AND m1>0;
PlotShapes(IIf(I2,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(I2,shapeDigit2 ,Null),colorLime,0,L,-45);
PlotShapes(IIf(I2,shapeUpArrow,Null),colorLime,0,L ,-30);
//Zero crossover down
R3=Cross(s1,m1) AND m1>0;
PlotShapes(IIf(R3,shapeCircle ,Null),colorBlack,0,H,25);
PlotShapes(IIf(R3,shapeDigit3 ,Null),colorRed,0,H,25);
PlotShapes(IIf(R3,shapeDownArrow,Null),colorRed,0, H,-10);
// crossover below zero
I4=Cross(0,m1);
PlotShapes(IIf(I4,shapeCircle ,Null),colorBlack,0,H,30);
PlotShapes(IIf(I4,shapeDigit4 ,Null),colorCustom12,0,H,30);
PlotShapes(IIf(I4,shapeDownArrow,Null),colorCustom 12,0,H,-15);
N41=Cross(0,AO);
PlotShapes(IIf(N41,shapeCircle ,Null),colorBlack,0,H,45);
PlotShapes(IIf(N41,shapeDigit4 ,0) ,colorCustom12, 0, H,45);
PlotShapes(IIf(N41,shapeDownArrow ,0) ,colorCustom12, 0, H,-30);
Copet=Cross(A,AlligatorLips);
FullPosition=Cross(AlligatorLips,AlligatorJaw);
TrailingSTop=Cross(AlligatorLips,A);
CashOut=Cross(AlligatorJaw,AlligatorLips);
AlertIf( FullPosition, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\BeliAwang.wav", "Audio alert", 2 );
AlertIf( Copet, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Copet.WAV", "Audio alert", 2 );
AlertIf( CashOut, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\Jual.wav", "Audio alert", 2 );
AlertIf( TrailingStop, "SOUND C:\\Program Files\\AmiBroker\\RekamSuara\\AmbilUntung.wav", "Audio alert", 2 );
//SetChartBkColor( Color00);
color = IIf( C > AlligatorLips, IIf( C>AlligatorJaw, colorDarkYellow, colorSeaGreen), IIf(AlligatorJaw>AlligatorLips, colorDarkRed, colorTan));
SetChartBkColor( LastValue(color) );
_SECTION_END();
Chg=Ref(C,-1);
Title = EncodeColor(colorWhite)+ Title = SectorID( mode = 1 ) + " - " +Name() + " " + EncodeColor(2) + Date() +EncodeColor(11)+ " ~TI~ " + EncodeColor(colorWhite) + "{{INTERVAL}} " +
//EncodeColor(55)+ " Open: "+ EncodeColor(colorWhite)+ WriteVal(O,format=1.0) +
EncodeColor(55)+ " Open: "+ WriteIf(O==L,EncodeColor(colorBrightGreen),WriteIf (O==H,EncodeColor(colorRed),EncodeColor(colorWhite )))+ WriteVal(O,format=1.0) +
EncodeColor(55)+ " High: "+ EncodeColor(colorWhite) + WriteVal(H,format=1.0) +
EncodeColor(55)+ " Low: "+ EncodeColor(colorWhite)+ WriteVal(L,format=1.0) +
EncodeColor(55)+ " Close: "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colo rRed))+ WriteVal(C,format=1.0)+
EncodeColor(55)+ " Change: "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colo rRed))+ WriteVal(ROC(C,1),format=1.2)+ "%"+
// EncodeColor(55)+ " Volume: "+ EncodeColor(colorWhite)+ WriteVal(V,1)
EncodeColor(55)+ " Volume: "+ WriteIf(V>Ref(V,-1),EncodeColor(colorBrightGreen),EncodeColor(color Red))+ WriteVal(V,1)
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"
+"\n"+EncodeColor(colorCustom11)+"Buaya Lucu-Lucuan"
+"\n"+EncodeColor(colorLightOrange)+"by Timur Langit"
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"
+"\n"+EncodeColor(41)+"Digit 0: " + WriteIf(R3a,EncodeColor(colorGreen)+"Bearish crossover below zero",WriteIf(M0,EncodeColor(colorGreen)+"AO<-120",""))
+"\n"+EncodeColor(41)+"Digit 1: " + WriteIf(H1,EncodeColor(colorBlue)+"AO crossup zero","")
+"\n"+EncodeColor(41)+"Digit 2: " + WriteIf(I2,EncodeColor(colorBrightGreen)+"Bullish crossover above zero","")
+"\n"+EncodeColor(41)+"Digit 3: " + WriteIf(R3,EncodeColor(colorCustom12)+"Bearish crossover above zero","")
+"\n"+EncodeColor(41)+"Digit 4: " + WriteIf(I4,EncodeColor(colorPink)+"MACD cross below zero", WriteIf(N41,EncodeColor(colorPink)+"AO crossdown zero",""))
//+"\n"+EncodeColor(41)+"Awesome: " + WriteIf(M0,EncodeColor(colorGreen)+"AO<-120",WriteIf(j00,EncodeColor(colorGreen)+"AO<0",Wr iteIf(j01,EncodeColor(colorGreen)+"AO>0",WriteIf(j 11,EncodeColor(colorGreen)+"AO>120",""))))
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"
+"\n"+EncodeColor(41)+"[:::]Buaya Bilang: " + WriteIf(R3a,EncodeColor(colorWhite)+"Udah Boleh Nyopet",WriteIf(H1,EncodeColor(colorLightOrange)+" Udah Boleh Beli",
WriteIf(I2,EncodeColor(colorBrightGreen)+"Boleh Beli Lagi",WriteIf(R3,EncodeColor(colorRed)+"Kalo mau TP dulu silahkan",WriteIf(I4,EncodeColor(colorCustom12)+"H arus Clear Position nih",
WriteIf(N41,EncodeColor(colorCustom12)+"Harus Clear Position nih",WriteIf(j50,EncodeColor(colorWhite)+"Tuambah Lagi",WriteIf(j51,EncodeColor(colorYellow)+"Hati-hati",
WriteIf(zbuy,EncodeColor(colorGreen)+"Udah Boleh Beli",WriteIf(zsell,EncodeColor(colorRed)+"TP sudah tercapai","Neutral"))))))))))
+"\n"+EncodeColor(colorPink)+"==================== ====";