[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] elliot wave afl required


  • Date: Sun, 29 Nov 2009 12:58:19 +0100
  • From: reinsley <reinsley@xxxxxxxx>
  • Subject: Re: [amibroker] elliot wave afl required

PureBytes Links

Trading Reference Links

I have got these pieces of code I never used...

It may help you.


I read many years ago that The PTI ( Profit Taking Index to catch Wave4 
and Wave5) is a surface area calculation. I then check this point as I 
was using AG, but I did not remember the math formula. :(

Best regards



// ElliotWaves_Shapes_i


_SECTION_BEGIN( "ElliotWaves_Shapes_i");
ew=MA((H+L )/2,5 )-MA((H+L )/2,34);
Plot( ew, " ", 2, 1+8);
Plot( 0, " ", 1, 1);

/****counter*****/
up=Cross(ew,0 );DN=Cross(0 ,ew);
VAR1=Cum(UP);
VAR2=2*Cum (UP)-2*int (Cum(UP)/10 )*10+33; //count every 10 steps
VAR3=2*Cum (dn)-2*int (Cum(dn)/10 )*10+34 ;   // IF.....1*cum()=up_and_down
WriteVal( VAR1  ,1.8)+" VAR1  "; WriteVal( VAR2  ,1)+" VAR2  "; 
WriteVal( VAR3  ,1)+" VAR3  ";
PlotShapes(IIf(up,VAR2,IIf(dn,Var3,0)) , IIf(up,colorGreen,colorRed),  0 
,0);
//PlotShapes(IIf (up,VAR2,IIf(dn,Var3, 0)) , IIf(up,colorGreen,colorRed 
),  0 ,IIf(up,ew-50 ,IIf(var2,ew+50 ,ew)));
_SECTION_END();


*****************

//Elliot Fractals
/*
The basic definition of an 'up' fractal is a bar high that is both 
higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal 
progression.

If two bars in the progression have equal highs followed by two 
consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up 
the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.

The 5 bar formation works best on Daily or longer time frame charts.For 
intraday data charts we often use 9 bar, 13 bar and 21 bar formations 
for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND 
Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND 
Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND 
Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) 
AND Ref(L,2) > L AND Ref(L,3) > L;

//TODO: More filtering: Show only troughs that are around atrough in 
trix(9).

PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, 
L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, 
L,-12);

PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, 
H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, 
H,-12);

Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));

LastHigh[0] = H[0];
LastLow[0] = L[0];

LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{

	LastHigh[i] = LastHigh[i-1];
	LastLow[i] = LastLow[i-1];
	if (Up[i])
	{								
  		Valid[i] = True;
  		if (DownSignal[i])
		{
			//Sequence of 2 Up Fractals. Validate only the higher one.
			Valid[i] = H[i] >= H[LastHighIndex];
			Valid[LastHighIndex] = H[LastHighIndex] >  H[i];
		}
		LastHigh[i] = Max(H[i], H[LastHighIndex ]);	
		LastHighIndex = i;	
	}

	if (Down[i])
	{	
  		Valid[i] = True;
		if (UpSignal[i])
		{
			//Sequence of 2 Down Fractals. Validate only the lower one.
			Valid[i] = L[i] <= L[LastLowIndex];
			Valid[LastLowIndex] = L[LastLowIndex] <  L[i];
		}
	
		LastLow[i] = Min(L[i], L[LastLowIndex]);
		LastLowIndex = i;		
	}	
}

TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND 
Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > 
TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND 
Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < 
TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND 
Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND 
Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) 
OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR 
Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR 
Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));

//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);

//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, 
L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, 
H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) 
,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR 
ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);

/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
	State[i] = State[i-1];
	if (Maxi[i])
	{		
		State[i] = 1;//down
	}

	if (Mini[i])
	{		
		State[i] = 2;
	}

}

PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, 
colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );

/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{
	
	ALength = abs(startPrice - A);	BLength = abs(A-B);
	CLength = abs(B-C);

	Ratio1 = BLength  / CLength ;
	Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
	Cond2 = abs(Clength - ALength) < Delta  OR abs(Clength - 1.62 * 
ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;
	
	return Cond1 AND Cond2;
}

function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
	//Wave 2 should be beneath wave 1 start:
	Cond1 = Two > StartPrice AND Two < One;
	//Wave 4 - the same:
	Cond2 = Four > Two AND Four < Three;
	//Wave 5 should be <= wave 3
	Cond3 = abs(Three-Two) >= abs(Five - Four);
	//Wave 1 should be smaller than wave five, making wave 3 the biggest:
	Cond4 = abs(StartPrice - One) < abs(Five - Four);
	return Cond1 AND Cond2 AND Cond3 AND Cond4;
}
Plot(C,"",colorWhite,64);



Deepak Patade a écrit :
>  
> [Attachment(s) <#TopText> from Deepak Patade included below]
> 
> Prasanta,
> Hope this afl helps you
>  
> Deepak Patade,
> Nasik.
> 
> 
> ------------------------------------------------------------------------
> *From:* prasantaroy36 <prasantaroy36@xxxxxxxxx>
> *To:* amibroker@xxxxxxxxxxxxxxx
> *Sent:* Sat, November 28, 2009 10:09:16 PM
> *Subject:* [amibroker] elliot wave afl required
> 
>  
> 
> Dear friends
> 
> In advance get software elliot wave include for counting the wave & 
> future projected target with probability % ,but in ami does not have 
> this facility. Therefore i request to friends to provide elliot wave afl 
> just like in advanceget . I will be highly greatfull if Mr. THOMASZ 
> reply on my request.
> 
> Thanks
> 
> 
> 



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/