BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > Gann in BullCharts
  New Posts New Posts RSS Feed: Historical time and price cycles
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Historical time and price cycles

 Post Reply Post Reply
Author
Message Reverse Sort Order / View First Unread Post
cmacdon View Drop Down
BullCharts Guru
BullCharts Guru


Joined: 09 Sep 2012
Location: Brisbane
Posts: 236
Post Options Post Options   Quote cmacdon Quote  Post ReplyReply Direct Link To This Post Topic: Historical time and price cycles
    Posted: 14 Oct 2014 at 7:13pm
[author=Dr Charles MacDonald]
[citation="Bullcharts Forum, Gann subset and Bullscript discussions Ivan Sargent, A unique Approach to Forecasting Market Reversal Point, Halliker's Inc,2010"]

[Target=Price;]
TDate:=InputDate("Start Date", date(2014,3,24));
Datea:=BarsSince(OnOrSkipped(TDate));

{Parameters}
tme:=input("1=daily,6=hourly,24=15mins 36=10, 72=5, 180=2 minutes", 1, 1, 180);

a:= input("Historical Gradient", 1, .00001, 100);

b:= (a/tme);

Vib:=input("Main Vibration", 4, .001, 100);

Flag:=input("Vib Colour bars", 1, 0, 2);

Lev2:=input("2 = Show Other Horz Lines 2 to 4 Ivan Sargent", 2, 1, 2);

Lev2a:=input("2 = Show Horz Lines 5 to 8 Ivan Sargent", 1, 1, 2);

Lev2b:=input("2 = Show Horz Lines 9 to 16 Ivan Sargent", 1, 1, 2);

Lev2c:=input("2 = Show Horz Lines 17 to 24 Ivan Sargent", 1, 1, 2);

Lev3:=input("2 = Show Vert Lines Ivan Sargent", 1, 1, 2);

Rd:=input("Rounding The levels", 3, 0, 3);

{----------------------------------------------------------------------------------------}
z:=Zig(If(Outside() AND Ref(H,-1)>Ref(H,-2),H,If(Outside() AND Ref(L,-1)<Ref(L,-2),L,If((Outside() OR Inside()) AND C>O,H,If((Outside() OR Inside()) AND O>C,L,If(H>Ref(H,-1),H,If(L<Ref(L,-1),L,If(Ref(H,-1)>Ref(H,-2),H,If(Ref(L,-1)<Ref(L,-2),L,C)))))))),Vib,%);

ispeak := z>hist(z,1) and z>future(z,1);
istrough := z<hist(z,1) and z<future(z,1);

[linestyle=Solid; color=Red;width=2;]
If(datea,z,undefined);

{These are calculation mechanics needed to produced various Time and Volume outputs}
UpZig:=Z>ref(z,-1);
DownZig:=Z<ref(z,-1);

{-------------------------------------------------------------------------------------------}
{Additional Peak and Valley Horz lines}
[name=1st Swing peak; linestyle=Dotted; color=Blue; width=2]
pk1:=If(Lev2=2,Round(lastvalue(valuewhen(1,ispeak,H)),Rd),Undefined);
If(datea,pk1,undefined);

[name=2nd Swing peak; linestyle=Dotted; color=Blue; width=2]
pk2:=If(Lev2=2,Round(lastvalue(valuewhen(2,ispeak,H)),Rd),Undefined);
If(datea,pk2,undefined);

[name=3rd Swing peak; linestyle=Dotted; color=Blue; width=2]
pk3:=If(Lev2=2,Round(lastvalue(valuewhen(3,ispeak,H)),Rd),Undefined);
If(datea,pk3,undefined);

[name=4th Swing peak; clinestyle=Dotted; color=Blue; width=2]
pk4:=If(Lev2=2,Round(lastvalue(valuewhen(4,ispeak,H)),Rd),Undefined);
If(datea,pk4,undefined);

[name=5th Swing peak; linestyle=Solid; color=Cyan; width=2]

pk5:=If(Lev2a=2,Round(lastvalue(valuewhen(5,ispeak,H)),Rd),Undefined);
If(datea,pk5,undefined);

[name=6th Swing peak; color=Cyan; width=2]
pk6:=If(Lev2a=2,Round(lastvalue(valuewhen(6,ispeak,H)),Rd),Undefined);
If(datea,pk6,undefined);

[name=7th Swing peak; color=Cyan; width=2]
pk7:=If(Lev2a=2,Round(lastvalue(valuewhen(7,ispeak,H)),Rd),Undefined);
If(datea,pk7,undefined);

[name=8th Swing peak; color=Cyan; width=2]
pk8:=If(Lev2a=2,Round(lastvalue(valuewhen(8,ispeak,H)),Rd),Undefined);
If(datea,pk8,undefined);

[name=9th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk9:=If(Lev2b=2,Round(lastvalue(valuewhen(9,ispeak,H)),Rd),Undefined);
If(datea,pk9,undefined);

[name=10th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk10:=If(Lev2b=2,Round(lastvalue(valuewhen(10,ispeak,H)),Rd),Undefined);
If(datea,pk10,undefined);;

[name=11th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk11:=If(Lev2b=2,Round(lastvalue(valuewhen(11,ispeak,H)),Rd),Undefined);
If(datea,pk11,undefined);

[name=12th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk12:=If(Lev2b=2,Round(lastvalue(valuewhen(12,ispeak,H)),Rd),Undefined);
If(datea,pk12,undefined);

[name=13th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk13:=If(Lev2b=2,Round(lastvalue(valuewhen(13,ispeak,H)),Rd),Undefined);
If(datea,pk13,undefined);

[name=14th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk14:=If(Lev2b=2,Round(lastvalue(valuewhen(14,ispeak,H)),Rd),Undefined);
If(datea,pk14,undefined);

[name=15th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk15:=If(Lev2b=2,Round(lastvalue(valuewhen(15,ispeak,H)),Rd),Undefined);
If(datea,pk15,undefined);

[name=16th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk16:=If(Lev2b=2,Round(lastvalue(valuewhen(16,ispeak,H)),Rd),Undefined);
If(datea,pk16,undefined);

[name=17th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk17:=If(Lev2c=2,Round(lastvalue(valuewhen(17,ispeak,H)),Rd),Undefined);
If(datea,pk17,undefined);

[name=18th Swing peak; linestyle=Dotted; color=Sky Blue; width=2]
pk18:=If(Lev2c=2,Round(lastvalue(valuewhen(18,ispeak,H)),Rd),Undefined);
If(datea,pk18,undefined);

[name=19th Swing peak; linestyle=Long Dash; color=Green; width=1]
pk19:=If(Lev2c=2,Round(lastvalue(valuewhen(19,ispeak,H)),Rd),Undefined);
If(datea,pk19,undefined);

[name=20th Swing peak; linestyle=Long Dash; color=Green; width=1]
pk20:=If(Lev2c=2,Round(lastvalue(valuewhen(20,ispeak,H)),Rd),Undefined);
If(datea,pk20,undefined);

[name=21st Swing peak; linestyle=Long Dash; color=Green; width=1]
pk21:=If(Lev2c=2,Round(lastvalue(valuewhen(21,ispeak,H)),Rd),Undefined);
If(datea,pk21,undefined);

[name=22nd Swing peak; linestyle=Long Dash; color=Green; width=1]
pk22:=If(Lev2c=2,Round(lastvalue(valuewhen(22,ispeak,H)),Rd),Undefined);
If(datea,pk22,undefined);

[name=23th Swing peak; linestyle=Long Dash; color=Green; width=1]
pk23:=If(Lev2c=2,Round(lastvalue(valuewhen(23,ispeak,H)),Rd),Undefined);
If(datea,pk23,undefined);

[name=24th Swing peak; linestyle=Long Dash; color=Green; width=1]
pk24:=If(Lev2c=2,Round(lastvalue(valuewhen(24,ispeak,H)),Rd),Undefined);
If(datea,pk24,undefined);


[name=1st Swing trough; linestyle=Dotted; color=Red; width=2]
tr1:=If(Lev2=2,Round(lastvalue(valuewhen(1,istrough,L)),Rd),Undefined);
If(datea,tr1,undefined);

[name=2nd Swing trough; linestyle=Dotted; color=Red; width=2]
tr2:=If(Lev2=2,Round(lastvalue(valuewhen(2,istrough,L)),Rd),Undefined);
If(datea,tr2,undefined);

[name=3rd Swing trough; linestyle=Dotted; color=Red; width=2]
tr3:=If(Lev2=2,Round(lastvalue(valuewhen(3,istrough,L)),Rd),Undefined);
If(datea,tr3,undefined);

[name=4th Swing trough; linestyle=Dotted; color=Red; width=2]
tr4:=If(Lev2=2,Round(lastvalue(valuewhen(4,istrough,L)),Rd),Undefined);
If(datea,tr4,undefined);

[name=5th Swing trough; color=Orange; width=2]
tr5:=If(Lev2a=2,Round(lastvalue(valuewhen(5,istrough,L)),Rd),Undefined);
If(datea,tr5,undefined);

[name=6th Swing trough; color=Orange; width=2]
tr6:=If(Lev2a=2,Round(lastvalue(valuewhen(6,istrough,L)),Rd),Undefined);
If(datea,tr6,undefined);

[name=7th Swing trough; color=Orange; width=2]
tr7:=If(Lev2a=2,Round(lastvalue(valuewhen(7,istrough,L)),Rd),Undefined);
If(datea,tr7,undefined);

[name=8th Swing trough; color=Orange; width=2]
tr8:=If(Lev2a=2,Round(lastvalue(valuewhen(8,istrough,L)),Rd),Undefined);
If(datea,tr8,undefined);

[name=9th Swing trough; linestyle=Solid; color=Gray; width=1]
tr9:=If(Lev2b=2,Round(lastvalue(valuewhen(9,istrough,L)),Rd),Undefined);
If(datea,tr9,undefined);

[name=10th Swing trough; linestyle=Solid; color=Gray; width=1]
tr10:=If(Lev2b=2,Round(lastvalue(valuewhen(10,istrough,L)),Rd),Undefined);
If(datea,tr10,undefined);

[name=11th Swing trough; linestyle=Solid; color=Gray; width=1]
tr11:=If(Lev2b=2,Round(lastvalue(valuewhen(11,istrough,L)),Rd),Undefined);
If(datea,tr11,undefined);

[name=12th Swing trough; linestyle=Solid; color=Gray; width=1]
tr12:=If(Lev2b=2,Round(lastvalue(valuewhen(12,istrough,L)),Rd),Undefined);
If(datea,tr12,undefined);

[name=13th Swing trough; linestyle=Solid; color=Gray; width=1]
tr13:=If(Lev2b=2,Round(lastvalue(valuewhen(13,istrough,L)),Rd),Undefined);
If(datea,tr13,undefined);

[name=14th Swing trough; linestyle=Solid; color=Gray; width=1]
tr14:=If(Lev2b=2,Round(lastvalue(valuewhen(14,istrough,L)),Rd),Undefined);
If(datea,tr14,undefined);

[name=15th Swing trough; linestyle=Solid; color=Gray; width=1]
tr15:=If(Lev2b=2,Round(lastvalue(valuewhen(15,istrough,L)),Rd),Undefined);
If(datea,tr15,undefined);

[name=16th Swing trough; linestyle=Solid; color=Gray; width=1]
tr16:=If(Lev2b=2,Round(lastvalue(valuewhen(16,istrough,L)),Rd),Undefined);
If(datea,tr16,undefined);

[name=17th Swing trough; linestyle=Dotted; color=Black; width=1]
tr17:=If(Lev2c=2,Round(lastvalue(valuewhen(17,istrough,L)),Rd),Undefined);
If(datea,tr17,undefined);

[name=18th Swing trough; linestyle=Dotted; color=Black; width=1]

tr18:=If(Lev2c=2,Round(lastvalue(valuewhen(18,istrough,L)),Rd),Undefined);
If(datea,tr18,undefined);

[name=19th Swing trough; linestyle=Long Dash; color=Black; width=1]

tr19:=If(Lev2c=2,Round(lastvalue(valuewhen(19,istrough,L)),Rd),Undefined);
If(datea,tr19,undefined);

[name=20th Swing trough; linestyle=Long Dash; color=Black; width=1]

tr20:=If(Lev2c=2,Round(lastvalue(valuewhen(20,istrough,L)),Rd),Undefined);
If(datea,tr20,undefined);

[name=21st Swing trough; linestyle=Long Dash; color=Black; width=1]

tr21:=If(Lev2c=2,Round(lastvalue(valuewhen(21,istrough,L)),Rd),Undefined);
If(datea,tr21,undefined);

[name=22th Swing trough; linestyle=Long Dash; color=Black; width=1]

tr22:=If(Lev2c=2,Round(lastvalue(valuewhen(22,istrough,L)),Rd),Undefined);
If(datea,tr22,undefined);

[name=23th Swing trough; linestyle=Long Dash; color=Black; width=1]

tr23:=If(Lev2c=2,Round(lastvalue(valuewhen(23,istrough,L)),Rd),Undefined);
If(datea,tr23,undefined);

[name=24th Swing trough; linestyle=Long Dash; color=Black; width=1]

tr24:=If(Lev2c=2,Round(lastvalue(valuewhen(24,istrough,L)),Rd),Undefined);
If(datea,tr24,undefined);

{-------------------------------------------------------------------------------------------}
[Visible=True;]
[name=Hi Vertical; linestyle=verticalmarker; color=Orange; width=1]
aV:=if(Lev3=2,if(isPeak, 1, undefined),undefined);
If(datea,aV,undefined);

[name=Lo Vertical; linestyle=verticalmarker; color=Lime Green; width=1]
bV:=if(Lev3=2,if(istrough, 1, undefined),undefined);
If(datea,bV,undefined);

{-------------------------------------------------------------------------------------------}

{This section takes up price colour bars }

[linestyle=PriceColor]

[name=Upswing barsl; Color=Royal Blue]
ub:=If(UpZig,1,0);
ub;

[name=DownswingBars; Color=Red]
db:=If(DownZig,1,0);
db;

BC User since June 2007
Back to Top
cmacdon View Drop Down
BullCharts Guru
BullCharts Guru


Joined: 09 Sep 2012
Location: Brisbane
Posts: 236
Post Options Post Options   Quote cmacdon Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 2014 at 7:10pm
BC User since June 2007
Back to Top
cmacdon View Drop Down
BullCharts Guru
BullCharts Guru


Joined: 09 Sep 2012
Location: Brisbane
Posts: 236
Post Options Post Options   Quote cmacdon Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 2014 at 7:09pm
BC User since June 2007
Back to Top
cmacdon View Drop Down
BullCharts Guru
BullCharts Guru


Joined: 09 Sep 2012
Location: Brisbane
Posts: 236
Post Options Post Options   Quote cmacdon Quote  Post ReplyReply Direct Link To This Post Posted: 14 Oct 2014 at 7:08pm
As you know Gann always said history repeats, what happened in the past will happen again in the future.

Ivan Sargent in his book A unique approach to forecasting market reversal points, Halliker's 2010 uses the remnants of past time and price cycles to produce a grid which forms the basis of forecasting future points where price and time may meet and reversals may occur.

Sargent acknowledges researching Gann, Bayer and Andrews methods in his early research; so, I thought it appropriate to apply his method to sizing Gann Squares. I have used the method to set the size and forecast periods of Gann Squares based on previous time and price cycles.

It is really a cycles based variant of trying to find an appropriate vibration for a stock. So below are three charts explain the indicator then I will post the Bullscript code for the indicator.

Because it is also linked to filtered wave sizing it can be complimentary to the earlier post using filtered waves to assess vibrations.

Normally you would not show 24 past cycles and, in his book Sargent suggests 5 - 12 are sufficient for his method.



Edited by cmacdon - 14 Oct 2014 at 7:15pm
BC User since June 2007
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz