• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Example of fibonacci retracement...please

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

    Example of fibonacci retracement...please

    Is there an example how to use the FibonacciRetracements from a script and specially how to access the price levels from the PriceLevels collection.
    I need the calculated price of 38.20% for example and my cod is:
    FibonacciRetracements myFibRet = Draw.FibonacciRetracements(this, "Fibtag", true, 40, dFibStart, 0, dFibEnd);
    myFibRet.IsExtendedLinesRight = true;
    double dRes = myFibRet.PriceLevels[2].GetPrice(this, dFibStart, dFibEnd, false); And there is error in GetPrice() function. I couldn't find any help for this method. I do not know even the parameters i have to pass to GetPrice method,

    Please help.
    Thank You.

    #2
    Originally posted by krasisoft View Post
    Is there an example how to use the FibonacciRetracements from a script and specially how to access the price levels from the PriceLevels collection.
    I need the calculated price of 38.20% for example and my cod is:
    FibonacciRetracements myFibRet = Draw.FibonacciRetracements(this, "Fibtag", true, 40, dFibStart, 0, dFibEnd);
    myFibRet.IsExtendedLinesRight = true;
    double dRes = myFibRet.PriceLevels[2].GetPrice(this, dFibStart, dFibEnd, false); And there is error in GetPrice() function. I couldn't find any help for this method. I do not know even the parameters i have to pass to GetPrice method,

    Please help.
    Thank You.
    The levels are not exposed properties of that IDrawObject. You will have to calculate any levels you want from the StartY and EndY values. It is the arithmetic of proportions.

    ref: http://ninjatrader.com/support/helpG...tracements.htm

    Comment


      #3
      Originally posted by koganam View Post
      The levels are not exposed properties of that IDrawObject. You will have to calculate any levels you want from the StartY and EndY values. It is the arithmetic of proportions.

      ref: http://ninjatrader.com/support/helpG...tracements.htm
      Thank you for the answer.
      I'm calculating the levels manually now, but what is the purpose of the FibonacciRetracements object??? - Just to show the graphics on the chart??? Will be nice if we can use some data from it...like the already calculated levels price for example... Now if i show the graphics on the chart and manually calculate the levels will be double calculations and slow performance. So I prefer to do not show fibonacci graphics to gain some speed.

      Comment


        #4
        Hello,

        The PriceLevels is actually a public property of the PriceLevelContainer so any script that inherits from this class when used as a DrawingObject from NinajaScript can get the defined levels.

        Here is a simple example of how to draw a fibonacci, get its defined levels and also hide it if needed.

        Code:
        if (State != State.Realtime) return;
        FibonacciExtensions extension = Draw.FibonacciExtensions(this, "test", true, 100, Close[100],  0, Close[0], 0, Close[0]);
        ClearOutputWindow();
        foreach (PriceLevel priceLevel in extension.PriceLevels)
        {
        		//priceLevel.Stroke = new Stroke(Brushes.Transparent);
        		double totalPriceRange = extension.EndAnchor.Price - extension.StartAnchor.Price;
        		double price = priceLevel.GetPrice(null, extension.EndAnchor.Price, totalPriceRange, true);
        		Print(price);
        }
        edit: I realized the prior code only provided the percent level, this should allow to get the price from an indicator.

        This code is already used in the Fibonacci tools, I just copied it into the indicator, null is provided for the chartScale as the actual method does not use the overload so I am unsure why that is there specifically but null can be used.

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 12-22-2015, 10:54 AM.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello,

          The PriceLevels is actually a public property of the PriceLevelContainer so any script that inherits from this class when used as a DrawingObject from NinajaScript can get the defined levels.

          Here is a simple example of how to draw a fibonacci, get its defined levels and also hide it if needed.

          Code:
          if (State != State.Realtime) return;
          FibonacciExtensions extension = Draw.FibonacciExtensions(this, "test", true, 100, Close[100],  0, Close[0], 0, Close[0]);
          ClearOutputWindow();
          foreach (PriceLevel priceLevel in extension.PriceLevels)
          {
          		//priceLevel.Stroke = new Stroke(Brushes.Transparent);
          		double totalPriceRange = extension.EndAnchor.Price - extension.StartAnchor.Price;
          		double price = priceLevel.GetPrice(null, extension.EndAnchor.Price, totalPriceRange, true);
          		Print(price);
          }
          edit: I realized the prior code only provided the percent level, this should allow to get the price from an indicator.

          This code is already used in the Fibonacci tools, I just copied it into the indicator, null is provided for the chartScale as the actual method does not use the overload so I am unsure why that is there specifically but null can be used.

          I look forward to being of further assistance.
          Wrong version of NT.

          Edit: I need to read better. Obviously from his code, he is talking NT8. I just looked at the forum title and assumed that he must be talking NT7. My mistake.

          Comment


            #6
            Hello,

            Yes quite the confusing thread here, I will move this to the correct forum to prevent any confusion.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by YevhenShynkarenko, Yesterday, 01:22 AM
            2 responses
            37 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by testingsarasa, 05-20-2018, 02:50 PM
            11 responses
            733 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by martyn73, Today, 05:27 PM
            2 responses
            9 views
            0 likes
            Last Post martyn73  
            Started by MichaelAlexander, 02-22-2017, 05:06 AM
            5 responses
            1,402 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by walter739, Today, 11:56 AM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X