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

How to get price of Fibonacci levels

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

    How to get price of Fibonacci levels

    How can I get the price of some fibonacci level?
    eg. I have this code:
    Code:
    IFibonacciExtensions iFibExt = DrawFibonacciExtensions("FibExt_" + patternId, false, pointA.Date, pointA.High, pointB.Date, pointB.Low, pointC.Date, pointC.High);
                                    FibonacciExtensions ext = (FibonacciExtensions)iFibExt;
                                    foreach (NinjaTrader.Gui.Chart.FibonacciLevel level in ext.Levels)
                                        level.Active = false;
    
                                    ext.Levels[0].Active = true;
                                    ext.Levels[0].Value = 0;
                                    ext.Levels[1].Active = true;
                                    ext.Levels[1].Value = 0.68;
                                    ext.Levels[2].Active = true;
                                    ext.Levels[2].Value = 1;
                                    ext.Levels[3].Active = true;
                                    ext.Levels[3].Value = 1.68;
    I'd like to know the price at Level[3] (168%).
    Last edited by Luigio; 03-08-2019, 08:22 AM.

    #2
    Hello Luigio,

    Thanks for your post.

    With reference to this thread: https://ninjatrader.com/support/foru...bonacci-levels, my colleague advised, "This would not be possible in NT7 as the tool was not designed to expose levels in Price.".

    You can calculate these price by using the last value (pointC.High) and taking the difference of PointA - PointB times the % value and either add (or subtract) from PointC as needed. I've attached a screenshot where I have manually applied an extension with some arbitrary values for demonstration purposes, the levels are not meaningful and are not a recommendation are only for education.

    The extension levels drawn are 114%, 123%, 136.8%

    PointA is at the price level of 7123.25

    PointB is at the price level of 7026.00

    PointC is at the price level of 7080.75

    The length is PointA to PointB which is 7123.25 - 7026.00 = 97.25

    The 114% extension would then be 97.25 times 1.14 = 110.865 The 114% line is then plotted at 7080.75 (PointC) - 110.865 = 6969.885.

    The 123% extension would then be 97.25 times 1.23 = 119.6175. The 123% line is then plotted at 7080.75 ( PointC ) - 119.6175 = 6961.1325.

    The 136.8% extension would then be at 97.25 * 1.368 = 133.038. The 136.8% line is then plotted at 7080.75 ( PointC ) - 133.038 = 6947.712.

    (There are minor rounding differences between what I calculated by hand and what the program provided and these are insignificant for the purpose of explaining).

    You can certainly code this using just the three points you use to programmatically draw the extension and then the extension percentages themselves.

    Click image for larger version

Name:	Luigio-1.PNG
Views:	423
Size:	35.5 KB
ID:	1050715
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi thats how I figured it out. Thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by PaulMohn, Today, 03:49 AM
      0 responses
      7 views
      0 likes
      Last Post PaulMohn  
      Started by inanazsocial, Today, 01:15 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      10 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      4 views
      0 likes
      Last Post dustydbayer  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      23 views
      0 likes
      Last Post trilliantrader  
      Working...
      X