Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Square of Nine

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Square of Nine

    I have done some work on Gann Square of Nine.

    << SquareOfNine code removed due to issues reported by EZ >>

    The attached indicator was written for my own trading, there are several places where it can be improved, but for my use it is fine. If it suits your needs, then I'm glad to have helped. If it just does not work for you then you have some base code to work with

    Square Nine is a mathematical progression of numbers produced by incrementing each value by a step size (usually 1) in a spiral fashion, with a "seed" number in the center of the spiral.

    From what I gather in reading articles on the net, this technique was intended by Gann to be based off of a recent Swing Hi/Lo, where the price at that Swing would be the "seed" value for the center of the Spiral.

    Well, I did not program it that way. My exposure to Square of 9, came from Gio at tradingelements.com. Her use of Square of 9, always used a seed value of 0.

    When used in this way an issues arises.
    For Instruments that trade with small whole number values, like the Euro, and other currencies, and a lot of stocks, the SQ9 values, calculated as above, are too far apart to be of practical use in trading.

    to compensate for this, a power of 10 factor must be used to shift the values outward in the spiral, to arrive at SQ9 values that are more meaningful for trading. I call these synthetic Square of 9. I can find no reference in Gann material supporting this, it is just the way I learned it.

    The input parameter ScaleOffset is provided to allow this shifting for Synthetic Squares, Set to 0 to use internally assigned values for ScaleOffset.

    When transitioning to the next level of the spiral , one gets a large jump in value, from (level n, angle 270), to (level n+1, angle 0). To avoid this jump the increase between levels is evenly distributed on angles between 270 and 0/360, thereby creating a smoother transition.

    This indicator calculates the Major Squares at (0,90,180,270 degrees) and plots them with a Blue dashed line, it also calculates the minor Squares at angles divisible by 22.5 degrees, plotting them as magenta lines

    The indicator finds a SQ9 value which is close to the Symbol value being charted. It then plots 15 SQ9 lines below, and 15 lines above that value. It uses lines because they are not included in the chart scaling calculations, so that lines not close to price do not skew the displayed chart. It repeats this at the beginning or each new trading day, which works well for what I trade. (Stock Index)

    Using this on daily charts, will produce odd looking charts.

    As price advances about half way to the next SQ9 value, the chart's "white space" is adjusted to bring the next SQ9 line onto the chart, this allows using Chart Trader to place/move target orders around the SQ if so desired.
    Attached Files
    Last edited by tquinn; 08-29-2007, 07:07 AM. Reason: Code doesn't work for some users

    #2
    SQ9... White Space Adjustment Issues...

    First let me thank you for this quite nifty indicator which is often spot on with the intra-day price moves of the indexes I trade.

    However, I have run into a bit of a snag and not being a coder or programmer, I was wondering if you had any ideas on how to overcome the problem.

    While I love the SQ9 indicator lines.. it seems that perhaps the white space adjustments cause my ebands to stop advancing forward. I tried substituting a smoothed moving average in place of the ebands, but then that indicator quickly got artificially drug right into the prices and I had to reload the ninjascript in order to correct it. With the ebands, those white space adjusments seem to cause them to stop moving and I have to also reload ninjascript again in order to get them to catch up with price. I use the ebands for trend identification, etc. and if I have to constantly refresh things to get them to run, this isn't going to work.

    Is there a simple work-around that I can insert into your code somewhere that will solve this problem? I would really love to continue using the SQ9 but I have also come to rely on being able to run ebands or whatever on the price panel as well. I am simply guessing it is this occasional white space adjustment done by the SQ9 indicator that is the fly in the ointment.

    Perhaps alternatively there is a simple way to stop the white space adjustment? That way the SQ9 lines would come into view with the movement of price just as any other S/R line would and then perhaps it won't skew my other indicators. If I wish to see the next SQ9 levels sooner, I can always grab the Y-axis and scrunch it down for a sec to see where they are and set a target there via the chart-trader as well.

    Anyway, many thanks for making this available.. it is sometimes uncanny how often price respects these levels.

    Best Regards and Happy Trading,
    Randy (EZ)
    Last edited by randyjb; 08-28-2007, 05:55 PM.

    Comment


      #3
      EZ,

      Sorry for the frustration. please delete the SquareOfNine code from your Indicator folder.

      I have removed the code from my original post so hopefully others won't have to go through the same frustration.

      Tom

      Comment


        #4
        SQ9 code..

        Gosh Tom...

        No apologies necessary on your part whatsoever.

        However, I guess in retrospect I wouldn't have said anything if I thought your response was going to be to just yank your indicator from the original post.

        Rather than removing the indicator from my folder I will instead open up the script and keep playing with the code over time to see if I can simply eliminate just the white space adjustment aspect which, at least to me, appears to be unnecessary to the usefulness of the placement of the minor and major SQ9 lines. In fact, I suspect if you had left the code here, someone could have figured it out and adjusted the indicator for us all.

        Ah well, thanks anyway, and I am sorry to have bothered you about this issue.

        Best Regards and Happy Trading
        EZ

        Comment


          #5
          EZ,
          My objective in posting this indicator (or any code) in the "NinjaScript File Sharing" forum is to provide stable, functioning code, to the NT user community. I believe this is the intent of the forum moderators.

          If I post something here which proves to be buggy, such that it does not work correctly on all PCs (as identified by you) then, I believe, it is best to "yank" the code, than try to make it a project for the community to fix.

          For this reason I pulled the code for this SquareOfNine indicator.

          If I needed help getting it to work I would post on the "NinjaScript Development Forum". However, since the indicator works well on my system I am not planning to make any fixes, for future release.

          My apology to all who have had trouble using this code. I will be more diligent with future contributions to this Forum, to verify the suitability of my code prior to posting.

          Tom

          Comment


            #6
            HI Tquinn,did u upgrade this for NT7.IFnot,plz do that and post in the forum.

            Comment


              #7
              I'm have not made any changes to the code. I am using it with NT ver7. The issue randyjb had was never addressed.

              Comment


                #8
                Thanks for your reply.can u post this indicator here again plz.

                Comment


                  #9
                  what is the lastest version of the square nine indicator for nt7?
                  Is it better just to get the numbers off a website instead? Do you have any you recomend?

                  Comment


                    #10
                    U can check the one available here in download section.Basically,we use it as a support/resistance lines.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    661 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    376 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    110 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    574 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    580 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X