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

[amibroker] Hilbert sine wave indicator- Is this afl the latest Next to better volume


  • Date: Sun, 29 Nov 2009 16:12:58 -0000
  • From: "rvlv" <rvlv@xxxxxxxxx>
  • Subject: [amibroker] Hilbert sine wave indicator- Is this afl the latest Next to better volume

PureBytes Links

Trading Reference Links

Friends,

Reference to better volume indicator link,
http://emini-watch.com/free-stuff/volume-indicator/ (contains hilbert sinewave link too)

I would like to know if the following is the latest afl on this subject,please clarify

The hilbert sinewave shown on the link is looking a bit different.
Possible reason being use of JMA, jurik tools.
Since there are equivalent alternatives to JMA giving almost same result, can we have this modified, please
Is there Some kind of zerolag impact  needed ?

-----------------------------------------------------------
//Using the Hilbert Metastock code, my interpetation of this 
//indicator that indicates whether a stock is trending OR
//NOT. This is set up as a system buying in at the start of
//a trend.
//This code has been borrowed from the Metastock
//Equis site AND interpetated as best I could.

//What this indicator is attempting to show is 
//where a stock is in a trending condition.

//http://www.equis.com/customer/support/formulas/cf00105.html
//"Hilbert indicators tell you when to trade"

//I set the squelch level to be 15. This can vary
//depending on your equities own history. 
//The MS indicator uses a value of 20.
//Formula:
/* Hilbert Study */
//Please clarify my doubt BY= KARTHIK MARAR

//Why are we plotting c1. I thought we had to Plot c3. 
//Otherwise what was the point in calculating c3.

S3 = C; 
s4=TimeNum();
radius = 0.45 * Status("pxheight"); 
textoffset = 2.4 * radius;
GfxSelectFont("Tahoma", 15 );
GfxSetTextColor( colorBlue );
GfxTextOut(Date() ,textoffset -500,15 ); 
GfxSetTextColor( colorBlue );
GfxTextOut( "HILBERT STUDY-GR0=C1,GR1=AMA,GR2=EMA9 Close =" + s3, textoffset -500, 40 );
GfxTextOut( "ADX(14) " + ADX(14), textoffset -530, 65 );



EnableScript("VBScript");
value1=((H+L)/2) - Ref(((H+L)/2),-6);
value2= Ref(value1,-3);
value3=0.75*(value1-Ref(value1,-6)) + 0.25*(Ref(value1,-2)-Ref(value1,-4));

<%
  value1 = AFL("Value1")
  value2 = AFL("Value2")
  value3 = AFL("Value3")
  Close = AFL("Close")
  inphase = Close
  quad = inphase

Call Setup()
    
function Setup()
	for i = 1 to Ubound(Close)
	   inphase(i) =  0.33 * value2(i) + (0.67 * inphase(i-1) )  
                   quad(i)    = 0.20  * value3(i) + ( 0.8 * quad(i-1) )
	next
End function

AFL.Var("inphase") = inphase
AFL.Var("quad") = quad
%>
p1  =  atan( 
                   abs(quad+Ref(quad,-1) )   / abs(inphase+Ref(inphase,-1) ) 
                 )
                  *     360 /3.1416;
phase = IIf(inphase<0 AND quad>0, 180-p1, 
  IIf(inphase<0 AND quad<0, 180+p1,
  IIf(inphase>0 AND quad<0, 360-p1,p1)));
dp  =  IIf(Ref(phase,-1)<90 AND phase>270,
360+Ref(phase,-1)-phase,Ref(phase,-1)-phase);
dp2 = IIf(dp < 1, 1,
  IIf(dp > 60, 60, dp));

Graph1 = dp2;

HilbertCyclePeriod1a = dp2;
value = dp2;

HCycleCount1a=
IIf(Sum(value,6)>=360 AND Sum(value,5)<360 ,6,0) +
IIf(Sum(value,7)>=360 AND Sum(value,6)<360 ,7,0) +
IIf(Sum(value,8)>=360 AND Sum(value,7)<360 ,8,0) +
IIf(Sum(value,9)>=360 AND Sum(value,8)<360 ,9,0) +
IIf(Sum(value,10)>=360 AND Sum(value,9)<360 ,10,0) +
IIf(Sum(value,11)>=360 AND Sum(value,10)<360 ,11,0) +
IIf(Sum(value,12)>=360 AND Sum(value,11)<360 ,12,0) +
IIf(Sum(value,13)>=360 AND Sum(value,12)<360 ,13,0) +
IIf(Sum(value,14)>=360 AND Sum(value,13)<360 ,14,0) +
IIf(Sum(value,15)>=360 AND Sum(value,14)<360 ,15,0);

HCycleCount2a =
IIf(Sum(value,16)>=360 AND Sum(value,15)<360 ,16,0) +
IIf(Sum(value,17)>=360 AND Sum(value,16)<360 ,17,0) +
IIf(Sum(value,18)>=360 AND Sum(value,17)<360 ,18,0) +
IIf(Sum(value,19)>=360 AND Sum(value,18)<360 ,19,0) +
IIf(Sum(value,20)>=360 AND Sum(value,19)<360 ,20,0) +
IIf(Sum(value,21)>=360 AND Sum(value,20)<360 ,21,0) +
IIf(Sum(value,22)>=360 AND Sum(value,21)<360 ,22,0) +
IIf(Sum(value,23)>=360 AND Sum(value,22)<360 ,23,0) +
IIf(Sum(value,24)>=360 AND Sum(value,23)<360 ,24,0) +
IIf(Sum(value,25)>=360 AND Sum(value,24)<360 ,25,0);

HCyclecount3a = 
IIf(Sum(value,26)>=360 AND Sum(value,25)<360 ,26,0) +
IIf(Sum(value,27)>=360 AND Sum(value,26)<360 ,27,0) +
IIf(Sum(value,28)>=360 AND Sum(value,27)<360 ,28,0) +
IIf(Sum(value,29)>=360 AND Sum(value,28)<360 ,29,0) +
IIf(Sum(value,30)>=360 AND Sum(value,29)<360 ,30,0) +
IIf(Sum(value,31)>=360 AND Sum(value,30)<360 ,31,0) +
IIf(Sum(value,32)>=360 AND Sum(value,31)<360 ,32,0) +
IIf(Sum(value,33)>=360 AND Sum(value,32)<360 ,33,0) +
IIf(Sum(value,34)>=360 AND Sum(value,33)<360 ,34,0) +
IIf(Sum(value,35)>=360 AND Sum(value,34)<360 ,35,0);

c1=  HCycleCount1a + HCycleCount2a + HCycleCount3a;
/*
graph0 = HCycleCount1a;
graph1 = HCyclecount2a;
Graph2 = HCyclecount3a;
Graph0Style=Graph1Style=Graph2Style=5;
*/
<%
c1 = AFL("c1")
c2 = c1
c3 = c1
	for i = 1 to Ubound(c1)
                      if c1(i) = 0 then c2(i) = c2(i-1) else c2(i) = c1(i) 
                      c3(i) = 0.25*c2(i) + 0.75*c3(i-1)  
                next

AFL.Var("quad") = c1
%>

GraphXSpace = 1;

/* playing a little here with moving averages, the Hilbert curve
    using Amibroker seems a lot more jagged than the one
    produced using Metastock.  I do not understand this
   difference but using a moving average produces a curve
   that is closer to Metastocks results than the one that I 
   produced as an interpetation.  */

fast = 2/(2+1);
slow = 2/(30+1);
dir=abs(Close-Ref(Close,-5));
vol=Sum(abs(Close-Ref(Close,-1)),5);
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2;

Graph0 = c1;
Graph1 = AMA( c1, sc );
Graph2 = EMA(c1,9);

Graph0Style=Graph1Style=Graph2Style=4;

/* Squelch  here is used as 15 instead of 20 on the site */
Squelch = 15;

var1 = Graph2;
Buy = IIf(var1 < Squelch , 0 , 1);
Sell = IIf( var1 < Squelch ,  1, 0 );
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

/* Exploration code */

/* filter is setup so that you can test any particular date and
   see the followup performance.  Just make sure that that
   date is at least 3 * first days in the past from the current
   date, otherwise the future references will produce the 
   wrong information or no information useful */

Filter = Buy==1;

first=1;  
/* First is the number of days for each ROC interval for reviewing performance
*/

NumColumns = 7;
Column0 = C;
Column0Format = 1.2;
Column0Name = "Close";
Column1 = Ref(C, 1+first);
Column1Name = "Close+i ";
Column1Format = 1.2;
Column2 = Ref(C,1+first*2);
Column2Name = "Close+i*2   ";
Column2Format = 1.2;
Column3 =  Ref(C,1+first*3);
Column3Name = "Close+i*3 ";
Column3Format = 1.2;
Column4= Ref(C,first*1+1)  -  C;
Column4Name="ROC+i";
Column4Format = 1.2;
Column5=  Ref(C,first*2+1)  -  C;
Column5Name="ROC+2i";
Column5Format = 1.2;
Column6=  Ref(C,first*3+1)  -  C;
Column6Name="ROC+3i";
Column6Format = 1.2;

/*  End of Exploration Code. */
============================================

thanks
rvlv



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

**** 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/