Help needed to understand this AFL

#1
Hi,

can some one help me to understand this afl and how to use it effectivily:p

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)+"==================== ====";
 

KelvinHand

Well-Known Member
#2
Hi,

can some one help me to understand this afl and how to use it effectivily:p
The main portion is William's Alligator System with fractal, making it very colorful & fanciful. Adding unnecessary ZigZag
Copy from http://www.amibroker.com/library/detail.php?id=1104 and mix and match.
Adding Alligator Oscillator, MACD Stoch buy sell condition

To trade it effectively, go to read Bill William's Books. And Study how the Alligator/Buaya/Crocodile behavior, Jaw, Teeth & Lips work.

Here is my Modification:

PHP:
/*
Dedicated to Obrolan Bandar & AmiBroker Indonesia
By Timur Langit......
May 2010
Dibantu oleh Eko Widjajanto dan Irwan 
*/

SoundAlertPath ="SOUND C:\\Windows\\Media\\";


_SECTION_BEGIN("BW Price Chart");

SetChartOptions( 0, chartShowArrows|chartShowDates );
//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)
    clr =colorBlack;
else
    clr = IIf (Close >= Ref(C, -1), colorBrightGreen, colorRed);

Plot( C, "Price", clr, PriceStyleOpt); 

_SECTION_END();



_SECTION_BEGIN("ZigZag");

bShowZZLine = ParamToggle("Show ZigZag Line", "No|Yes", 1);
bShowZZSym = ParamToggle("ShowZigZag High/Low Symbol", "No|Yes", 1);

percentChange = 3;
ZZ = Zig(C,LastValue(PercentChange)) ; 

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);


if (bShowZZLine)
Plot(ZZ,"", colorBlue,styleThick|styleNoLabel);

if (bShowZZSym)
{
PlotShapes( IIf(PivotLow,shapeCircle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(PivotHigh,shapeCircle,0) ,ColorRGB(255,0,255), 0, H,12);
}

_SECTION_END();


_SECTION_BEGIN("BW Alligator");

bShowAlligator = ParamList("Show BW", "Off|Alligator|Alligator++|All", 3);
bShow=0;
switch (bShowAlligator)
{
  case "All": bShow=3; break;
  case "Alligator": bShow=1; break;
  case "Alligator++": bShow=2; break;
  
  
}
//-- Copy from http://www.amibroker.com/library/detail.php?id=1104

MP = (H+L)/2;
AlligatorJaw = Ref(Wilders(MP,13),-8);
AlligatorTeeth = Ref(Wilders(MP,8), -5);
AlligatorLips = Ref(Wilders(MP,5), -3);

if ( bShow&1)
{
Plot(AlligatorJaw, "", colorBlue, styleThick | styleNoLabel);
Plot(AlligatorTeeth,"", colorRed, styleThick | styleNoLabel);
Plot(AlligatorLips, "", colorDarkGreen,styleThick | styleNoLabel);
}

//-- Make it Fanciful & colorful onto the BW Alligator
if ( bShow&2)
{
PlotOHLC( C,C,AlligatorLips,AlligatorLips, "", IIf(C>AlligatorLips,colorLime,colorRed), styleCloud| styleNoLabel);
PlotOHLC( AlligatorLips,AlligatorLips,AlligatorJaw,AlligatorJaw, "", IIf(AlligatorLips>AlligatorJaw,colorYellow,colorPink), styleCloud| styleNoLabel);
}
_SECTION_END();


_SECTION_BEGIN("BW Fractals");
//-- Fractal -----
bShowFractals = ParamToggle("Show Fractals Line", "No|Yes", 1);
bShowFractalsSym = ParamToggle("Show Fractals Symbols", "No|Yes", 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));

if (bShowFractals)
{
Plot(UpFractalMax, "BF" ,33, styleThick);
Plot(DownFractalMin, "SF",11, styleThick);
}

if (bShowFractalsSym)
{
PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeSmallCircle,0) ,colorBlue, 0, L,-2);
PlotShapes( IIf(DownFractalMin>Ref(DownFractalMin,-1),shapeHollowCircle,0) ,colorWhite, 0, L,-2);
}
_SECTION_END();


_SECTION_BEGIN("BW Awesome Oscillator");
//-- AO 
SlowMA=MA( MP,34);
FastMA=MA( MP,5);
AO=FastMA-SlowMA;

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);


//-- AO & Fractal Alert Setting
j50 = DownFractalMin>Ref(DownFractalMin,-1); 
j51 = AO<0 AND C<Ref(DownFractalMin,-1) OR AO>0 AND C<Ref(DownFractalMin,-1) ;

AlertIf( j50, SoundAlertPath + "Ding.wav", "Audio alert", 2 );
AlertIf( j51, SoundAlertPath + "Ding.wav", "Audio alert", 2 );

M0=IIf(AO<-120,IIf(AO>Ref(AO,-1) AND Ref(AO,-1)<Ref(AO,-2),1,0),0);
PlotShapes( IIf(M0,shapeSmallCircle,null) ,colorWhite, 0, L,-2);
PlotShapes( IIf(M0,shapeHollowCircle,null) ,colorDarkGreen, 0, L,-2);
AlertIf( M0, SoundAlertPath + "Ding.wav", "Audio alert", 2 );

_SECTION_END();


_SECTION_BEGIN("MACD Setting");
r1 = Param( "Fast", 12, 2, 200, 1 );
r2 = Param( "Slow", 26, 2, 200, 1 );
r3 = Param( "Signal", 9, 2, 200, 1 );

m1=MACD(r1,r2);
s1=Signal(r1,r2,r3);

_SECTION_END();

_SECTION_BEGIN("Stochastic Setting");
st1 = Param( "%K", 14, 2, 200, 1 );
st2 = Param( "Smth(%K)", 34, 2, 200, 1 );
st3 = Param( "%D", 8, 2, 200, 1 );

StoK=StochK( st1 , st2);
StoD=StochD( st1 , st2, st3 );


Sto_Buy =  Cross(StoK, StoD );
Sto_Sell = Cross( StoD, StoK );

_SECTION_END();

_SECTION_BEGIN("Buy/Sell Arrows");

//-- All the Buy/Sell condition from AO, MACD, Stoch

//-- Digit_1: AO Cross Up 0 
AO_H1=Cross(AO,0);
PlotShapes(IIf(AO_H1,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(AO_H1,shapeDigit1 ,0) ,colorGold, 0, L,-45);
PlotShapes(IIf(AO_H1,shapeUpArrow ,0) ,colorGold, 0, L,-30);


//Digit_4: AO Cross Dn 0
AO_N41=Cross(0,AO);
PlotShapes(IIf(AO_N41,shapeCircle ,Null),colorBlack,0,H,45);
PlotShapes(IIf(AO_N41,shapeDigit4 ,0) ,colorCustom12, 0, H,45);
PlotShapes(IIf(AO_N41,shapeDownArrow ,0) ,colorCustom12, 0, H,-30);



//--Digit_0: MACD Cross Up when Bearish
Macd_R3a=Cross(m1,s1) AND m1<0;
PlotShapes(IIf(Macd_R3a,shapeCircle ,Null),colorBlack,0,L,-30);
PlotShapes(IIf(Macd_R3a,shapeDigit0 ,Null),colorWhite,0,L,-30);
PlotShapes(IIf(Macd_R3a,shapeUpArrow,Null),colorWhite,0 ,L,-15);


//Digit 2: MACD Cross up when Bullish
Macd_I2=Cross(m1,s1) AND m1>0;
PlotShapes(IIf(Macd_I2,shapeCircle ,Null),colorBlack,0,L,-45);
PlotShapes(IIf(Macd_I2,shapeDigit2 ,Null),colorLime,0,L,-45);
PlotShapes(IIf(Macd_I2,shapeUpArrow,Null),colorLime,0,L ,-30);


//Digit 3: MACD Cross Down when Bullish
Macd_R3=Cross(s1,m1) AND m1>0;
PlotShapes(IIf(Macd_R3,shapeCircle ,Null),colorBlack,0,H,25);
PlotShapes(IIf(Macd_R3,shapeDigit3 ,Null),colorRed,0,H,25);
PlotShapes(IIf(Macd_R3,shapeDownArrow,Null),colorRed,0, H,-10);

//Digit 4: MACD Cross below zero
Macd_I4=Cross(0,m1);
PlotShapes(IIf(Macd_I4,shapeCircle ,Null),colorBlack,0,H,30);
PlotShapes(IIf(Macd_I4,shapeDigit4 ,Null),colorCustom12,0,H,30);
PlotShapes(IIf(Macd_I4,shapeDownArrow,Null),colorCustom12,0,H,-15);



// Check Stoch cross up when AO Bearish
A00=IIf(AO<0,IIf(Sto_Buy,1,0),0);
PlotShapes( IIf(A00,shapeSmallCircle,0) ,colorWhite, 0, L,-2);
PlotShapes( IIf(A00,shapeHollowCircle,0) ,colorDarkGreen, 0, L,-2);
AlertIf( A00, SoundAlertPath + "Ding.wav", "Audio alert", 2 );

// Check Stoch cross down when AO Bullish
Z01=IIf(AO>0,IIf(Sto_Sell,1,0),0);
PlotShapes( IIf(Z01,shapeSmallCircle,0) ,colorRed, 0, H,2);
PlotShapes( IIf(Z01,shapeHollowCircle,0) ,colorBlack, 0, H,2);
AlertIf( Z01, SoundAlertPath + "Ding.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, SoundAlertPath + "Ding.wav", "Audio alert", 2 );




BW_Copet=Cross(MP,AlligatorLips);
AlertIf( BW_Copet, SoundAlertPath + "Ding.wav", "Audio alert", 2 );

BW_FullPosition=Cross(AlligatorLips,AlligatorJaw);
AlertIf( BW_FullPosition, SoundAlertPath + "Ding.wav", "Audio alert", 2 );

BW_TrailingStop=Cross(AlligatorLips,MP);
AlertIf( BW_TrailingStop, SoundAlertPath + "Ding.wav", "Audio alert", 2 );


BW_CashOut=Cross(AlligatorJaw,AlligatorLips);
AlertIf( BW_CashOut, SoundAlertPath + "Ding.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();


_SECTION_BEGIN("Display Titles");
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(colorRed))+ WriteVal(C,format=1.0)+ 
EncodeColor(55)+ " Change: "+ WriteIf(C> Chg,EncodeColor(colorBrightGreen),EncodeColor(colorRed))+ 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(colorRed))+ WriteVal(V,1)
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"
+"\n"+EncodeColor(colorCustom11)+"BW Alligrator"
+"\n"+EncodeColor(colorLightOrange)+"by Timur Langit"
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"

+"\n"+EncodeColor(41)+"Digit 0: " + WriteIf(Macd_R3a,EncodeColor(colorGreen)+"Bearish crossover below zero",WriteIf(M0,EncodeColor(colorGreen)+"AO<-120",""))
+"\n"+EncodeColor(41)+"Digit 1: " + WriteIf(AO_H1,EncodeColor(colorBlue)+"AO crossup zero","")
+"\n"+EncodeColor(41)+"Digit 2: " + WriteIf(Macd_I2,EncodeColor(colorBrightGreen)+"Bullish crossover above zero","")
+"\n"+EncodeColor(41)+"Digit 3: " + WriteIf(Macd_R3,EncodeColor(colorCustom12)+"Bearish crossover above zero","")
+"\n"+EncodeColor(41)+"Digit 4: " + WriteIf(Macd_I4,EncodeColor(colorPink)+"MACD cross below zero", WriteIf(AO_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",""))))


//-- Google Translator
+"\n"+EncodeColor(colorPink)+"-----------------------------------------"
+"\n"+EncodeColor(colorYellow)+"[:::]Alligator Say: " + WriteIf(Macd_R3a,EncodeColor(colorWhite)+"Possible Buy Up",WriteIf(AO_H1,EncodeColor(colorLightOrange)+" May Buy Now",
WriteIf(Macd_I2,EncodeColor(colorBrightGreen)+"May Buy Again",WriteIf(Macd_R3,EncodeColor(colorRed)+"Please TP first",WriteIf(Macd_I4,EncodeColor(colorCustom12)+"Must Clear Position now",
WriteIf(AO_N41,EncodeColor(colorCustom12)+"Must Clear Position Now",WriteIf(j50,EncodeColor(colorWhite)+"Add more",WriteIf(j51,EncodeColor(colorYellow)+"Caution",
WriteIf(PivotLow,EncodeColor(colorGreen)+"May Buy Now",WriteIf(PivotHigh,EncodeColor(colorRed)+"TP has been reached","Neutral")))))))))) 
+"\n"+EncodeColor(colorPink)+"==================== ====";

_SECTION_END();
 
Last edited:
#5
Hi KelvinHand,

I have one query regarding this AFL.
there are some full pink and blue point that change automatically:confused:
i have not seen any pink point that was a sell signal and now after 2-3 days when i open the chart again that sell signal was there...(before 2-3 days)
i am not getting this point, am i missing something...?
 

KelvinHand

Well-Known Member
#6
Hi KelvinHand,

I have one query regarding this AFL.
there are some full pink and blue point that change automatically:confused:
i have not seen any pink point that was a sell signal and now after 2-3 days when i open the chart again that sell signal was there...(before 2-3 days)
i am not getting this point, am i missing something...?
You go and reload the code again, and play with the parameters, turn on turn off the Yes/No to find out what exactly it is belong to before you ask.
 

Similar threads