Squaring price and Time |
Post Reply |
Author | |
cmacdon
BullCharts Guru Joined: 09 Sep 2012 Location: Brisbane Posts: 236 |
Post Options
Quote Reply
Topic: Squaring price and Time Posted: 11 Oct 2014 at 12:58pm |
[author=Dr Charles MacDonald]
[citation="Bullcharts Forum, Gann subset and Bullscript discussions Price and Time Squaring "] [Target=Price;] TDate:=InputDate("Date of trend", date(2014,3,24)); HD:=BarsSince(OnOrSkipped(TDate)); {------Note this is for intraday applications-------} tme:=input("1=daily,6=hourly,24=15mins 36=10, 72=5, 180=2 minutes", 1, 1, 180); z1:=If(HD,1,0); DwnswingCount:=If (z1,+prev(z1),0); DwnSwing:=barssince(z1=0); {In this case i want the indicator to have a manually input bottom---} {Bot:=valuewhen(1,HD=1,L);} Bot:=input("Input the Low on start day", 35.25, .0001, 10000); pdinp:=input("Average Day to calc gradient", 100, 1, 72000); {tme added for intraday conversion} pd:=pdinp; a:= input("Historical Gradient Vib => 1 X 1", 0.079, 0.00001, 10000); {---Conversion needed if applying daily angles on an intraday chart---} b:= a/tme; {--------This adds single text calc of the daily spread as a %-------} Gradient := b; {--------Some peripheral calculations need later on--------} {Count since start of Move} MoveSwing:=barssince(HD=0); {Adjacent} Days:=(DwnSwing-1); {----------------------Now Project the Top and Bottom for a Basic Square--------------------------} [name=O/8; linestyle=Horzline; Width=2; color=Black; visible=yes] bottom:=If ({HD and }Dwnswing <=pd+1,Bot,undefined); bottom; [linestyle=Text; fontsize=6; textalign=Below,center;color=Black;] if(barssince(Z1=0)and Dwnswing <=pd+1, int(Dwnswing-1) + " ", undefined); bottom; [name=8/8; linestyle=Horzline; Width=2; color=Black; visible=yes] Top:=If (HD and Dwnswing <=pd+1,(Bot-b) +(pd+1)*b,undefined); Top; {------add Gann Percentage levels within the square----------------------} [name=1/8; linestyle=Horzline; Width=1; color=Orange; visible=yes] oneeight:=If(HD and Dwnswing <=pd+1,Bottom + (Top-Bottom)*1/8,undefined); oneeight; [name=2/8;color=Black;Width=2;]; twoeight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*2/8,undefined); twoeight; [name=3/8; Width=1; color=Sea Green]; threeeight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*3/8,undefined); threeeight; [name=4/8;color=Black;Width=2;]; foureight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*4/8,undefined); foureight; [name=5/8; Width=1; color=Sea Green]; fiveeight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*5/8,undefined); fiveeight; [name=6/8; color=Black;Width=2;]; sixeight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*6/8,undefined); sixeight; [name=7/8; Width=1; color=Orange;] seveneight:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*7/8,undefined); seveneight; [name=8/8; color=Black;Width=2;]; eighteight:=If(HD and Dwnswing <=pd+1,Top,undefined); eighteight; [name=8/8; Width=1; color=Blue;] onethird:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*1/3,undefined); onethird; Twothird:=If(HD and Dwnswing <=pd+1, Bottom + (Top-Bottom)*2/3,undefined); Twothird; {Draw verticle Line as time elapses within the Square} [name=Start line; Linestyle=Fill Bars; Width=2; color=Black;] if(HD and Dwnswing=1,Top,undefined); if(HD and Dwnswing=1,Bot,undefined); [name=Quarter Time;] If (Dwnswing= round(((pd)/4)+1,0),Top,undefined); If (Dwnswing= round(((pd)/4)+1,0),Bot,undefined); [name=Half Time;] If (Dwnswing= round(((pd)/2)+1,0),Top,undefined); If (Dwnswing= round(((pd)/2)+1,0),Bot,undefined); [name=Three Quarter Time;] If (Dwnswing= round(((pd)*3/4),0)+1,Top,undefined); If (Dwnswing= round(((pd)*3/4),0)+1,Bot,undefined); [name=Price and time sb Square;] If (Dwnswing= round(((pd)),0)+1,Top,undefined); If (Dwnswing= round(((pd)),0)+1,Bot,undefined); Tp1:=If (Dwnswing= round(((pd)/4)+1,0),1,undefined); Tp2:=If (Dwnswing= round(((pd)/2)+1,0),1,undefined); Tp3:=If (Dwnswing= round(((pd)*3/4),0)+1,1,undefined); Tp4:=If (Dwnswing= round(((pd)),0)+1,1,undefined); {---Add Gann text applied to 1/8 and 1/3 Percentages Grid levels---Note Murrey Math also uses the 1/8 levels----} [linestyle=Text; textalign=Above,Left; color=Blue;] if(HD and Dwnswing <=1 and Bottom, Round(Bottom,2) + " )% ", undefined);Bottom; [linestyle=Text; textalign=Above,Left; color=Orange;] if(HD and Dwnswing <=1 and oneeight, Round(oneeight,2) + " 12.5% ", undefined);oneeight; [linestyle=Text; textalign=Above,Left; color=Magenta; ] if(HD and Dwnswing <=1 and twoeight, Round(twoeight,2) + " 25% ", undefined);twoeight; [linestyle=Text; textalign=Above,Left; color=Black; ] if(HD and Dwnswing <=1 and threeeight, Round(threeeight,2) + " 33.3% ",undefined);onethird; [linestyle=Text; textalign=Above,Left; color=Sea Green; ] if(HD and Dwnswing <=1 and threeeight, Round(threeeight,2) + " 37.5% ",undefined);threeeight; [linestyle=Text; textalign=Above,Left; color=Blue; ] if(HD and Dwnswing <=1 and foureight, Round(foureight,2) + " 50% ",undefined); foureight; [linestyle=Text; textalign=Above,Left; color=Sea Green; ] if(HD and Dwnswing <=1 and fiveeight, Round(fiveeight,2) + " 62.5% ", undefined);fiveeight; [linestyle=Text; textalign=Above,Left; color=Black; ] if(HD and Dwnswing <=1 and threeeight, Round(threeeight,2) + " 66.6% ",undefined);twothird; [linestyle=Text; textalign=Above,Left; color=Magenta; ] if(HD and Dwnswing <=1 and sixeight, Round(sixeight,2) + " 75% ", undefined);sixeight; [linestyle=Text; textalign=Above,Left; color=Orange; ] if(HD and Dwnswing <=1 and seveneight, Round(seveneight,2) + " 87.5% ",undefined);seveneight; [linestyle=Text; textalign=Above,Left; color=Blue; ] if(HD and Dwnswing <=1 and eighteight, Round(eighteight,2) + " 100% ",undefined);eighteight; |
|
BC User since June 2007
|
|
cmacdon
BullCharts Guru Joined: 09 Sep 2012 Location: Brisbane Posts: 236 |
Post Options Quote Reply Posted: 11 Oct 2014 at 12:54pm |
|
|
BC User since June 2007
|
|
cmacdon
BullCharts Guru Joined: 09 Sep 2012 Location: Brisbane Posts: 236 |
Post Options Quote Reply Posted: 11 Oct 2014 at 12:53pm |
|
|
BC User since June 2007
|
|
cmacdon
BullCharts Guru Joined: 09 Sep 2012 Location: Brisbane Posts: 236 |
Post Options Quote Reply Posted: 11 Oct 2014 at 12:52pm |
|
|
BC User since June 2007
|
|
cmacdon
BullCharts Guru Joined: 09 Sep 2012 Location: Brisbane Posts: 236 |
Post Options Quote Reply Posted: 11 Oct 2014 at 12:51pm |
Gann had methods to Square price and time from Tops, Bottoms Zero points and Ranges.
Set out below will be 4 charts showing some issue in writing Bullscript to get Gann Square indicator to work for these options. Lastly I will post code similar to the previous indicator but can be applied to produce Squares for any of the above methods. Some pitfalls in apply the indicator and distinguishing between a calendar day and a trading day calculation are shown. The examples below are for the DJIA around the time of the 1929 Crash discussed briefly in Gann's 1935 Course "The Basis of my Trading Method". Edited by cmacdon - 12 Oct 2014 at 3:43am |
|
BC User since June 2007
|
|
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 |