Expansion Pivot |
Post Reply |
Author | |
trev04
Newbie Joined: 15 Oct 2007 Location: Australia Posts: 7 |
Post Options
Quote Reply
Topic: Expansion Pivot Posted: 03 May 2009 at 1:19am |
I have been using Divergences in my system for some time now, successfully, but have had to run manually on BC, so I am happy to read up on the interest that has come about them recently in this forum.
Now I am trying to see if it is possibly to convert this code to BC, which is with pivot points. Analysists or experienced traders talking about an equity price nearing a certain support or resistance level, each of which is important because it represents a point at which a major price movement is expected to occur. Well they come up with these levels using pivot points, and there are several different methods for calculating pivot points which I a follow. Below is a code of an Expansion Pivot, and I am hoping that someone of you BC script buffs, would be able to complete the conversion to BC to see if it would work successfully showing the significant price movements. Ps: The code shown is Long only. If it can be converted and works, then the Short would be easy to add. Thanks in Regards to any Help!! Spike < ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 10">< name="Originator" ="Microsoft Word 10"> Expansion Pivot [Long Entry
Code] {Long Entry} RngLen:=6; Pds:=44;
LE:=If(H-L > Hist(HHV((H-L),RngLen),1) AND ((L <= ma(C,Pds,S)) OR Hist(L,1) <= Hist(ma(C,Pds,S),1)) AND C > ma(C,Pds,S),1,0) AND ma(C,Pds,S)>= Hist(ma(C,Pds,S),1); SE:=If(H-L > Hist(HHV((H-L),RngLen),1) AND ((H >= ma(C,Pds,S)) OR Hist(H,1) >= Hist(ma(C,Pds,S),1)) AND C < ma(C,Pds,S),1,0)AND ma(C,Pds,S)< Hist(ma(C,Pds,S),1); LongNumatr:=4; LongPeriods:=5;
LongSL:=L-LongNumatr*ATR(LongPeriods); Longstop:=If(L < PREV,LongSL,If(LongSL > PREV,LongSL,PREV)); LX:=L < Hist(Longstop,1); ShortNumatr:=4;
ShortPeriods:=5; ShortSL:=H+ShortNumatr*ATR(ShortPeriods);
Shortstop:=If(H > PREV,ShortSL,If(ShortSL < PREV,ShortSL,PREV)); SX:=H > Hist(Shortstop,1); Trade:=If( LE=1,1, If(SE=1,1, If((LX AND PREV=1) OR (SX AND PREV=1),0,PREV))); Cross( trade, 0.5 ) [Long Exit
Code] {Long Exit} RngLen:=6;
Pds:=44; LE:=If(H-L > Hist(HHV((H-L),RngLen),1) AND ((L <= Ma(C,Pds,S)) OR Hist(L,1) <= Hist(Ma(C,Pds,S),1)) AND C > Ma(C,Pds,S),1,0) AND Ma(C,Pds,S)>= Hist(Ma(C,Pds,S),1); SE:=If(H-L > Hist(HHV((H-L),RngLen),1) AND ((H >= Ma(C,Pds,S)) OR Hist(H,-1) >= Hist(Ma(C,Pds,S),1)) AND C < Ma(C,Pds,S),1,0)AND Ma(C,Pds,S)< Hist(Ma(C,Pds,S),1); LongNumatr:=4;
LongPeriods:=5; LongSL:=L-LongNumatr*ATR(LongPeriods);
Longstop:=If(L < PREV,LongSL,If(LongSL > PREV,LongSL,PREV)); LX:=L < Hist(Longstop,1); ShortNumatr:=4;
ShortPeriods:=5; ShortSL:=H+ShortNumatr*ATR(ShortPeriods);
Shortstop:=If(H > PREV,ShortSL,If(ShortSL < PREV,ShortSL,PREV)); SX:=H > Hist(Shortstop,1); Trade:=If( LE=1, 1, If(SE=1, 1, If((LX AND PREV=1) OR (SX AND PREV=1),0,PREV))); Cross( 0.5, trade ) |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 03 May 2009 at 6:09pm |
Hi Spike, I converted it and colored the signals to distinguish buys from sells. Cheers! { Expansion Pivot } RngLen:=6; Pds:=44;LongNumatr:=4; LongPeriods:=5; ShortNumatr:=4; ShortPeriods:=5; LE:= If(H-L > Hist(HHV((H-L),RngLen),1) AND ((L <= ma(C,Pds,S)) OR Hist(L,1) <= Hist(ma(C,Pds,S),1)) AND C > ma(C,Pds,S),1,0) AND ma(C,Pds,S)>= Hist(ma(C,Pds,S),1);SE:= If(H-L > Hist(HHV((H-L),RngLen),1) AND ((H >= ma(C,Pds,S)) OR Hist(H,1) >= Hist(ma(C,Pds,S),1)) AND C < ma(C,Pds,S),1,0)AND ma(C,Pds,S)< Hist(ma(C,Pds,S),1);LongSL:= L-LongNumatr*ATR(LongPeriods);Longstop:= If(L < PREV,LongSL,If(LongSL > PREV,LongSL,PREV));LX:= L < Hist(Longstop,1);ShortSL:= H+ShortNumatr*ATR(ShortPeriods);Shortstop:= If(H > PREV,ShortSL,If(ShortSL < PREV,ShortSL,PREV));SX:= H > Hist(Shortstop,1);Trade:= If( LE=1,1, If(SE=1,1, If((LX AND PREV=1) OR (SX AND PREV=1),0,PREV)));{ Long Entry } [color =lime green]Cross ( trade, 0.5 );{ Long Exit } [color =red]Cross ( 0.5, trade )
|
|
trev04
Newbie Joined: 15 Oct 2007 Location: Australia Posts: 7 |
Post Options Quote Reply Posted: 03 May 2009 at 7:46pm |
Maximo, thanks for your time converting the Pivot code for me. I'll have a closer look at what it may give and play with it a bit.
Cheers___!!! |
|
Post Reply |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |