different type of fractals

2
//Fractal up //---------- fUp = (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); var1=ValueWhen(fUp ,Ref(H,-2) ,1); FractalUp=HighestSince(var1 > 0, var1, 1); Plot(FractalUp, "F+",colorLime , styleLine | styleDots); FUpBuyPrice = FractalUp + 0.01; FUpHit = FUpBuyPrice <= H AND FUpBuyPrice >= L; FUpSignalOn = Flip(Ref(FractalUp,-1) != FractalUp, FUpHit); //Looks into the future. This is done only to display Fractal arrow at the right bar. //The calculation of the fractal up is done without looking into the future. //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); FDownSellPrice= FractalDown+ 0.01; FDownHit = FDownSellPrice <= H AND FDownSellPrice >= L; FDownSignalOn = Flip(Ref(FractalDown,-1) != FractalDown, FDownHit ); Plot(FractalDown, "F-", colorGrey40, styleLine | styleDots); //Looks into the future. This is done only to display Fractal arrow at the right bar. //The calculation of the fractal up is done without looking into the future. ================================================================================ = _SECTION_BEGIN ("BW Fractal"); CondUpFractal =(Ref(H,-2)<H AND Ref(H,-1)<H AND Ref(H,1)<H AND Ref(H,2)<H) OR (Ref(H,-3)<H AND Ref(H,-2)<H AND Ref(H,-1)==H AND Ref(H,1)<H AND Ref(H,2)<H) OR (Ref(H,-4)<H AND Ref(H,-3)<H AND Ref(H,-2)==H AND Ref(H,-1)==H AND Ref(H,1)<H AN D Ref(H,2)<H) OR (Ref(H,-4)<H AND Ref(H,-3)<H AND Ref(H,-2)==H AND Ref(H,-1)==H AND Ref(H,1)<H AN D Ref(H,2)<H) OR (Ref(H,-6)<H AND Ref(H,-5)<H AND Ref(H,-4)==H AND Ref(H,-3)<H AND Ref(H,-2)==H A ND Ref(H,-1)<H AND Ref(H,1)<H AND Ref(H,2)<H); UpFractal =ValueWhen(CondUpFractal,H,1); PlotShapes(CondUpFractal*shapeSmallCircle,colorBlack,Layer=0,UpFractal,Offset=9)

Upload: userin

Post on 10-May-2017

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Different Type of Fractals

//Fractal up//----------fUp = (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);var1=ValueWhen(fUp ,Ref(H,-2) ,1); FractalUp=HighestSince(var1 > 0, var1, 1);Plot(FractalUp, "F+",colorLime , styleLine | styleDots);

FUpBuyPrice = FractalUp + 0.01;FUpHit = FUpBuyPrice <= H AND FUpBuyPrice >= L;FUpSignalOn = Flip(Ref(FractalUp,-1) != FractalUp, FUpHit);

//Looks into the future. This is done only to display Fractal arrow at the right bar.//The calculation of the fractal up is done without looking into the future.

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

FDownSellPrice= FractalDown+ 0.01;FDownHit = FDownSellPrice <= H AND FDownSellPrice >= L;FDownSignalOn = Flip(Ref(FractalDown,-1) != FractalDown, FDownHit );

Plot(FractalDown, "F-", colorGrey40, styleLine | styleDots);//Looks into the future. This is done only to display Fractal arrow at the right bar.//The calculation of the fractal up is done without looking into the future.

=================================================================================

_SECTION_BEGIN("BW Fractal");CondUpFractal =(Ref(H,-2)<H AND Ref(H,-1)<H AND Ref(H,1)<H AND Ref(H,2)<H) OR

(Ref(H,-3)<H AND Ref(H,-2)<H AND Ref(H,-1)==H AND Ref(H,1)<H AND Ref(H,2)<H) OR

(Ref(H,-4)<H AND Ref(H,-3)<H AND Ref(H,-2)==H AND Ref(H,-1)==H AND Ref(H,1)<H AND Ref(H,2)<H) OR

(Ref(H,-4)<H AND Ref(H,-3)<H AND Ref(H,-2)==H AND Ref(H,-1)==H AND Ref(H,1)<H AND Ref(H,2)<H) OR

(Ref(H,-6)<H AND Ref(H,-5)<H AND Ref(H,-4)==H AND Ref(H,-3)<H AND Ref(H,-2)==H AND Ref(H,-1)<H AND Ref(H,1)<H AND Ref(H,2)<H);

UpFractal =ValueWhen(CondUpFractal,H,1);

PlotShapes(CondUpFractal*shapeSmallCircle,colorBlack,Layer=0,UpFractal,Offset=9)

Page 2: Different Type of Fractals

;

CondDownFractal =(Ref(L,-2)>L AND Ref(L,-1)>L AND Ref(L,1)>L AND Ref(L,2)>L) OR

(Ref(L,-3)>L AND Ref(L,-2)>L AND Ref(L,-1)==L AND Ref(L,1)>L AND Ref(L,2)>L) OR

(Ref(L,-4)>L AND Ref(L,-3)>L AND Ref(L,-2)==L AND Ref(L,-1)==L AND Ref(L,1)>L AND Ref(L,2)>L) OR

(Ref(L,-4)>L AND Ref(L,-3)>L AND Ref(L,-2)==L AND Ref(L,-1)==L AND Ref(L,1)>L AND Ref(L,2)>L) OR

(Ref(L,-6)>L AND Ref(L,-5)>L AND Ref(L,-4)==L AND Ref(L,-3)>L AND Ref(L,-2)==L AND Ref(L,-1)>L AND Ref(L,1)>L AND Ref(L,2)>L);

DownFractal =ValueWhen(CondDownFractal,L,1);

PlotShapes(CondDownFractal*shapeSmallCircle,colorBlack,Layer=0,DownFractal,Offset=-9);

PlotShapes(Cross(C,UpFractal) AND (Close>Chaos_Red)*shapeHollowUpArrow,colorWhite,Layer=0,L);

PlotShapes(Cross(DownFractal,C)*shapeHollowDownArrow,colorBlue,Layer=0,H);

=====================================================================================

_SECTION_BEGIN("BW Fractal");

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

//== Added Crash crashandburn59 [at] hotmail.com solution

//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Up Fractal", ParamColor("Up Fractal Color",colorRed), ParamStyle("Up Fractal Style", stylecircle));//Plot(Max(HHV(H,3),Ref(UpFractal,2)), "Down Fractal",ParamColor("Down Fractal Color",colorBlue), ParamStyle("Down Fractal Style", stylecircle));

_SECTION_END();