Print Page | Close Window

Expansion Pivot

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=560
Printed Date: 27 Apr 2025 at 5:54pm
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Expansion Pivot
Posted By: trev04
Subject: Expansion Pivot
Date 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 http://www.investopedia.com/terms/s/support.asp - support or http://www.investopedia.com/terms/r/resistance.asp - 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 http://www.investopedia.com/terms/p/pivotpoint.asp - 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 )





Replies:
Posted By: maximo
Date 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 )

 



Posted By: trev04
Date 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___!!!



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk