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

MT4 Conversion (Fibonacci Indicator)

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

    MT4 Conversion (Fibonacci Indicator)

    Maybe someone wants to take a crack at this one? Basically this indicator calculates all Fibonacci retracement levels from -500% to 500%.


    Rather than starting from scratch, perhaps it would be possible to modify this existing indicator?:

    "FibonacciRetracementsOnSession"


    Conceptually I have an idea of how it could be done but couldn't get the code right...
    Attached Files

    #2
    Hello,

    It is possible. Maybe someone from the forum community will assist you. Let us know if you have any specific questions. If you do please post the code and we will assist.
    DenNinjaTrader Customer Service

    Comment


      #3
      I'm not sure if this is right, but it seems to work somewhat.

      Ideally I think it would be better to use plots instead of the Fib draw tool, that way it would be cleaner looking and hopefully the values would be accessible from within strategies...
      Attached Files
      Last edited by Elliott Wave; 11-12-2008, 10:46 AM.

      Comment


        #4
        Hello,

        OK! Go ahead and try it. If it does not work please cut and paste your code questions and we will assist you.
        DenNinjaTrader Customer Service

        Comment


          #5
          What a pain...

          I think it works although I haven't tested it in a strategy yet.


          I'll post it here for testing purposes, and in case anyone wants to make any improvements/corrections
          Attached Files

          Comment


            #6
            Re: FibLines

            Thanks Elliott Wave,
            What a piece of engineering!It works- just thought I would say thank you for all your hard work. I changed a few things but only cosmetically as Gann lines work off different numbers.
            Picture attached.
            Attached Files

            Comment


              #7
              I like the color changes, it looks nice.

              Unfortunately this indicator has the same issue as the other one I posted in that it won't work in strategies (I can't figure out why) and that was basically the whole point of making it.

              Comment


                #8
                Hello everyone,
                Using this indicator in a strategy is not going to give you what you're looking for...although the parameter inputs can be tweaked to permit it being used in the strategy wizard. What you need to have done is an indicator written that lets you get the fib price level based on the current days session. Basically, it would take the fib percentage as an input (0.618 for example), and perhaps the session lookback id (0 for the current, developing session, 1 for yesterdays session, 2 for the session prior to yesterday, etc), and the indicator would then output the price value for that fib percentage.

                The FibRetraceOnSession has no means of returning this price value, it is really only good for visual display of the price value on the live or historical chart.

                Comment


                  #9
                  Thanks for responding Ben.

                  Your original indicator detects the high and low over a certain time frame and then uses that data to draw a Fibonacci retracement object. Great visually yes, but unfortunately as of yet, the values of drawn objects are not accessible through NinjaScript.

                  What I did is take your algorithm for detecting the high and low over a certain time period and in addition to drawing Fibonacci retracements with the Draw method, I manually calculated the fib levels and added those as separate (transparent) plots which can be accessed by any strategy.

                  Everything works except the 'aStartTime' variable causes errors when used in a strategy format. I find the ability to choose a start date much better than an arbitrary number of bars back. For example, the recent extreme trend in the USD and other currencies seems to have started around 9/26, with the way the indicator works now I can easily choose 9/26 as the start date, put the session length to 0, and have the correct fib levels drawn (and continue to adapt) over the length of the trend.

                  I think there is so much potential for Fibs in strategies.

                  A few uses:
                  -Using fib levels for profit targets
                  -Puting stops near the next nearest fib level
                  -Avoiding algorithmically determined stops being placed right on a fib level, but rather just on the other side to take better advantage of the resistance they provide.
                  - Perhaps most importantly, avoiding order entry until price breaks through the next fib level as there can be quite a few whipsaws while the price repeatedly tests theses levels.

                  Comment


                    #10
                    Hello,

                    I did not post the indicator. Perhaps you are referring to someone else?
                    DenNinjaTrader Customer Service

                    Comment


                      #11
                      Yes Ben...he was conversing with me (another Ben)

                      Elliot, what you did is correct: Manually calculate the fib levels and then expose them as plot values (so they can be accessible to any calling strategy).

                      About the date issue, what you'll need to do is break the date down into components. You'll need an integer parameter for the year, and an integer parameter for the month, and an integer parameter for the day. Then, within the indicator, you can use these parameters to manufacture a DateTime variable that controls the indicator.

                      Ben

                      Comment


                        #12
                        Thanks Ben(s). Logically, that makes a lot of sense. I'll try that tomorrow when I get some time.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by sightcareclickhere, Today, 01:55 PM
                        0 responses
                        1 view
                        0 likes
                        Last Post sightcareclickhere  
                        Started by Mindset, 05-06-2023, 09:03 PM
                        9 responses
                        258 views
                        0 likes
                        Last Post ender_wiggum  
                        Started by Mizzouman1, Today, 07:35 AM
                        4 responses
                        18 views
                        0 likes
                        Last Post Mizzouman1  
                        Started by philmg, Today, 01:17 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChristopherJ  
                        Started by cre8able, Today, 01:01 PM
                        1 response
                        9 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X