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, 11: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 NinjaTrader_ChelseaB, 01-08-2017, 06:59 PM
            80 responses
            19,665 views
            5 likes
            Last Post NinjaTrader_ChelseaB  
            Started by adeelshahzad, Today, 03:54 AM
            2 responses
            15 views
            0 likes
            Last Post adeelshahzad  
            Started by dappa, Today, 09:18 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by bill2023, Yesterday, 08:51 AM
            5 responses
            24 views
            0 likes
            Last Post bltdavid  
            Started by frankthearm, Today, 09:08 AM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Working...
            X