// Downloaded From https://www.WiseStockTrader.com //------------------------------------------------------------------------------ // // Formula Name: Williams Alligator system //------------------------------------------------------------------------------ // // This code attempts to do most of the Williams Alligator sytem // // where the terms fractal up and fractal down are used. Along // // with terms like Alligators month, lips, etc. // // To get a real picture of this go to the web site // // www.profitunity.com and download the demo software // // Investors Dream and see how this code compares. // // You really need to read the book to get a picture of // // what is going on. This is a good read. You can // // get the Williams books on his web site as will. You // // only need the latest one. // //------------------------------------------------------------------------------ /* The first set of lines are to set up the color coding for the price bars */ a = (H+L)/2; outsidebar = outside(); insidebar = H <= Ref(H,-1) and L >= Ref(L,-1); upbar = H > ref(H,-1) and L >= ref(L, -1); downbar = L < ref(L,-1) and H <= ref(H,-1); barcolor=iif(outsidebar, 1, iif(downbar, 4, iif(upbar,5, 6) ) ); /*The following builds the alligator lines*/ maxGraph=12; AlligatorBlue=Ref(Wilders(A,13),-8); Graph0=AlligatorBlue; AlligatorRed=Ref(Wilders(A,8),-5); Graph1=AlligatorRed; AlligatorGreen=Ref(Wilders(A,5),-3); Graph2=AlligatorGreen; Graph0Style=Graph1Style=Graph2Style=1+4; Graph3=C; Graph3Style=64; /*Red:* modified for Amibroker*/ /* Graph3Color=22; 22 is the number for dark green */ Graph3barcolor=barcolor; Graph2Color=27; /* 6 is green */ Graph1Color=5; /* 5 is red color */ Graph0color=7; /* 7 is dark blue */ /*The following builds Fractal Up*/ var1=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),1); FractalUp=HighestSince(var1>0,var1,1); Graph4=FractalUp; Graph4Color=3; /* 6 is green */ Graph4Style=9; /*The following builds Fractal Down*/ var2= (Ref(L,-2) <= Ref(L, -1)) AND (Ref(L,-2) <= Ref(L, 0)) AND (Ref(L,-2) <= Ref(L, -3)) AND (Ref(L,-2) <= Ref(L, -4)); FractalDown=ValueWhen( var2,Ref(L,-2),1); Graph5=FractalDown; Graph5Style=1; Graph5Color=8; /* red is 5 blue is 7 */ Graph5Style=9; /* Graph6=ma(c,17); graph7=ma(c,50); graph8=ma(c,200); graph6Style=Graph7Style=graph8Style=12; */ /* Below are the buy sell signals for testing */ buy = cross(H,FractalUp+0.065) and (C > AlligatorRed) ; Sell= A < AlligatorGreen or (ref(C,-2) < FractalUp and (ref(C,-1)