Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Automatic Fibonacci levels

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

    Automatic Fibonacci levels

    Is there an indicator that draws Fibonacci levels automatically based off yesterdays high low?
    I found one called anafibonacccicluster but it basis it of of the swings so including the current day!
    It's a pain in the a$$ manually drawing them everyday

    Thanks

    #2
    Hello geotabs,

    Thanks for your post.

    I am not aware of one and did a quick scan of the NT user apps, you are of course welcome to review as well at https://ninjatraderecosystem.com/use...r-8-indicators Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    If you wanted to create one it should be fairly simple. I would use the indicator PriorDayOHLC and on the first bar of the session pull the High/Low from the indicator and draw the fib once per session. Here is an example:


    Click image for larger version

Name:	geotabs-2.PNG
Views:	4620
Size:	104.6 KB
ID:	1123652

    You could go so far as to create a fib template that has the settings to extend to the right and put the labels to where you like and any other changes that you prefer. I just called the default template and manually change the settings for a quick demo. You would need to use the Draw.Fib... overload that allows the use of a specific template (or you can just set your default template like that and use the code I'm showing.

    Draw.FibonacciRetracements(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)
    Reference: https://ninjatrader.com/support/help...tracements.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello geotabs,

      Thanks for your post.

      I am not aware of one and did a quick scan of the NT user apps, you are of course welcome to review as well at https://ninjatraderecosystem.com/use...r-8-indicators Please note: The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

      If you wanted to create one it should be fairly simple. I would use the indicator PriorDayOHLC and on the first bar of the session pull the High/Low from the indicator and draw the fib once per session. Here is an example:


      Click image for larger version

Name:	geotabs-2.PNG
Views:	4620
Size:	104.6 KB
ID:	1123652

      You could go so far as to create a fib template that has the settings to extend to the right and put the labels to where you like and any other changes that you prefer. I just called the default template and manually change the settings for a quick demo. You would need to use the Draw.Fib... overload that allows the use of a specific template (or you can just set your default template like that and use the code I'm showing.

      Draw.FibonacciRetracements(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)
      Reference: https://ninjatrader.com/support/help...tracements.htm
      Hi Paul,

      I have recreated your screenshot example. However, fibs are not plotted and there are no errors recorded. Any Idea?

      Thanks.
      Attached Files

      Comment


        #4
        Hello aligator,

        Thanks for your reply.

        If you go to the first bar of the current session you will see the fib drawn on the first bar of the session.

        By default, the Fibonacci drawing tool does not extend its lines, and as I mentioned in my post I " manually change the settings for a quick demo.".

        Here is a screenshot of the changes made to the drawn Fibonacci you see in my post #2:

        Click image for larger version

Name:	Alligator-2.PNG
Views:	4026
Size:	29.7 KB
ID:	1123847


        A better usage here would be to create a Fibonacci template with it set as you wish and then use the method overload that allows you to specify the template to use.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_PaulH View Post
          Hello aligator,

          Thanks for your reply.

          If you go to the first bar of the current session you will see the fib drawn on the first bar of the session.

          By default, the Fibonacci drawing tool does not extend its lines, and as I mentioned in my post I " manually change the settings for a quick demo.".

          Here is a screenshot of the changes made to the drawn Fibonacci you see in my post #2:

          Click image for larger version

Name:	Alligator-2.PNG
Views:	4026
Size:	29.7 KB
ID:	1123847


          A better usage here would be to create a Fibonacci template with it set as you wish and then use the method overload that allows you to specify the template to use.
          Thanks Paul.

          I had not seen before a Fib drawn on one bar. Cool, all good!

          Comment


            #6
            Originally posted by aligator View Post

            Hi Paul,

            I have recreated your screenshot example. However, fibs are not plotted and there are no errors recorded. Any Idea?

            Thanks.
            Alligator, how would you update that to work for NT8?

            Comment


              #7
              Originally posted by natemallard View Post

              Alligator, how would you update that to work for NT8?
              If you mean the indicator in post # 3, it already works for NT8. Are you suggesting to update the code per Paul's suggestion.

              You can draw a fib then edit its properties and create a fib template of your liking and save it as "Prior Day Fibs" template. Then simply edit line 60 of the code in post # 3 as the following and then compile(F5).

              Code:
                              Draw.FibonacciRetracements(this, "PDFibs", false, 0, myPD.PriorHigh[0], 0, myPD.PriorLow[0], false, "Prior Day Fibs");
              Cheers!
              Last edited by aligator; 02-19-2022, 09:21 PM.

              Comment


                #8
                Originally posted by aligator View Post

                If you mean the indicator in post # 3, it already works for NT8. Are you suggesting to update the code per Paul's suggestion.

                You can draw a fib then edit its properties and create a fib template of your liking and save it as "Prior Day Fibs" template. Then simply edit line 60 of the code in post # 3 as the following and then compile(F5).

                Code:
                Draw.FibonacciRetracements(this, "PDFibs", false, 0, myPD.PriorHigh[0], 0, myPD.PriorLow[0], false, "Prior Day Fibs");
                Cheers!
                Alligator, thanks for the reply!! It is working wonderfully with charts besides the daily chart... is it possible to get this to work on a daily chart?

                Comment


                  #9
                  Originally posted by natemallard View Post

                  Alligator, thanks for the reply!! It is working wonderfully with charts besides the daily chart... is it possible to get this to work on a daily chart?
                  Yes, it is but it will be too crowded on the chart. Perhaps it is easier to manually draw when needed.

                  However, the code is much simpler, but once you change it will no longer work for other time frames. Best to open the code in editor make the following changes and save as some other new indicator name to keep the original unchanged.

                  1. Delete line 29,
                  2. Change line 36 to Calculate.OnPriceChange;
                  3. Delete lines 50 and 58
                  4. change line 60 to Draw.FibonacciRetracements(this, "PDFibs", false, 0, High[1], 0,Low[1], false, "Prior Day Fibs");
                  5. Save as a new indicator name
                  6. Compile(F5)

                  Let me know if works.

                  Hi NinjaTrader_PaulH

                  The above changes will draw fibs on daily charts only. Perhaps you could suggest changes to your original indicator to plot prior day fibs for all time frames, including on a daily chart.

                  Thanks.
                  Last edited by aligator; 02-21-2022, 12:31 PM.

                  Comment


                    #10
                    Originally posted by aligator View Post

                    Yes, it is but it will be too crowded on the chart. Perhaps it is easier to manually draw when needed.

                    However, the code is much simpler, but once you change it will no longer work for other time frames. Best to open the code in editor make the following changes and save as some other new indicator name to keep the original unchanged.

                    1. Delete line 29,
                    2. Change line 36 to Calculate.OnPriceChange;
                    3. Delete lines 50 and 58
                    4. change line 60 to Draw.FibonacciRetracements(this, "PDFibs", false, 0, High[1], 0,Low[1], false, "Prior Day Fibs"); if you need a template.
                    If no template use Draw.FibonacciRetracements(this, "PDFibs", false, 0, High[1], 0,Low[1]); for default template.
                    5.Compile and save as a new indicator name

                    Let me know if works.

                    Hi NinjaTrader_PaulH

                    The above changes will draw fibs on daily charts only. Perhaps you could suggest changes to your original indicator to plot prior day fibs for all time frames, including on a daily chart.

                    Thanks.
                    Thanks again! The only error I see so far is I am getting this message: "The namespace 'NinjaTrader.NinjaScript.Indicators' already contains a definition for 'PriorDayFibs'

                    Comment


                      #11
                      Originally posted by natemallard View Post

                      Thanks again! The only error I see so far is I am getting this message: "The namespace 'NinjaTrader.NinjaScript.Indicators' already contains a definition for 'PriorDayFibs'
                      Need to change line 27 class name consistent with your new name on line 35, then compile.

                      Comment


                        #12
                        aligator
                        Thanks for your help on this thread! I was able to make the indicator to draw the fib from the previous day High and low.
                        One thing I am trying to figure out is how to be able to call upon this indicator for back testing reasons . Say take a long if it breaks the 68% or 100% ( even extended levels like 137% ect, ect. Would there be an easy way to call on those levels or would I have to build in the Fib indicator to a strategy with custom code? No worries about coding anything up for me, Just pointing me in the right direction should be helpful!

                        Comment


                          #13
                          Originally posted by aligator View Post

                          Hi Paul,

                          I have recreated your screenshot example. However, fibs are not plotted and there are no errors recorded. Any Idea?

                          Thanks.
                          Hello Alligator, I tried to modify your code to have the same indicator on the week and the month, but without result, could you help me please?​

                          Comment


                            #14
                            Originally posted by filoo7 View Post

                            Hello Alligator, I tried to modify your code to have the same indicator on the week and the month, but without result, could you help me please?​
                            Please see and follow instructions in Post # 7, and the following posts if you need to.

                            Comment


                              #15
                              Originally posted by aligator View Post

                              Please see and follow instructions in Post # 7, and the following posts if you need to.
                              I have tried as you say but it still remains in Prior Day.
                              I can't spend it in Prior Week
                              I am sorry maybe I do it badly, I don't know how to code ...
                              Paul proposed to use the PriorDayOHLC indicator.
                              So I tried to modify the code of your message 3 by replacing line 29 so that it is based on the PriorWeekOHLC rather than the PriorDayOHLC but it does not work​
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by LawrenHom, Today, 10:45 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post LawrenHom  
                              Started by love2code2trade, Yesterday, 01:45 PM
                              4 responses
                              28 views
                              0 likes
                              Last Post love2code2trade  
                              Started by funk10101, Today, 09:43 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post funk10101  
                              Started by pkefal, 04-11-2024, 07:39 AM
                              11 responses
                              37 views
                              0 likes
                              Last Post jeronymite  
                              Started by bill2023, Yesterday, 08:51 AM
                              8 responses
                              44 views
                              0 likes
                              Last Post bill2023  
                              Working...
                              X