Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

fibonacci by x-axis

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

    fibonacci by x-axis

    Hello,

    I am using Draw.FibonacciRetracements tool. Does it have to be in OnBarUpdate or can we use it in OnRender as well?

    I want to convert a price double in to axis corrdinate to pass the value inside the object? HA variable:

    Draw.FibonacciRetracements(this, "tag1", true, HA, High[HA], 213, Low[213]);

    How can i do that?
    It seem to get the axis you must retreive it from the OnRender class? Than i have to make it available in OBU? Is it possible?

    Frank
    Thank you

    #2
    Hello frankduc,

    Drawing objects should generally be placed in OnBarUpdate. If used from OnRender that could have a performance impact because OnRender is called very frequently.

    Can you provide some detail on what you are trying to do?

    Comment


      #3
      I am using a variable with a double number.

      If the variable price is 4470, i want to be able to pass the variable into the drawing object.
      It says that you can pass bars startBarsAgo, that is ok if you know the bar value but if it is a number like a number (price) it need to be converted into bars or x , y axis coordinate to bar?

      You see where i am going?

      TY
      Last edited by frankduc; 08-11-2023, 08:18 AM.

      Comment


        #4
        Hello frankduc,

        If you have a price value you don't need to use OnRender, you already have a price. You would just supply that directly to the drawing object in OnBarUpdate. Using OnRender wouldn't help to find the BarsAgo for that price, you would need to know the specific time that price happened to be able to calculate the bars ago for the series used.

        Comment


          #5
          If my variable is name price in OBU and its value = 4470.
          If i pass variable price in the object it return error impossible to convert double to int.

          Draw.FibonacciRetracements(this, "tag1", true, price, High[price], 213, Low[213]);

          Comment


            #6
            Hello frankduc,

            That sounds like you used the variable in the wrong location. You have price being used as the BarsAgo.

            Draw.FibonacciRetracements(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY)


            https://ninjatrader.com/support/help...highlightsub=F ibonacciRetracements

            If you mean that to be a bars ago you need to make it an int variable.

            Comment


              #7
              i tried only with price variable and input manually a price but its not working: error: NinjaScript File Error Code Line Column
              CMADateTime.cs No overload for 'FibonacciRetracements' method takes arguments 5 CS1501 94 5​

              Draw.FibonacciRetracements(this, "tag1", true, price, 4560);

              Comment


                #8
                Hello frankduc,

                You need to specify both a bars ago and a price. You need to fill in all of the parameters:

                Draw.FibonacciRetracements(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY)

                Comment


                  #9
                  Jesse,

                  If its a price from a variable that dont have a barAgo, like a price from nowhere 4470, how do i get the barAgo value of that price?
                  I dont get it. Don t you have a clear example of that?

                  TY

                  Comment


                    #10
                    Hello frankduc,

                    You can't calculate a bars ago from just a price. You need to know when that price happened in time to get a bars ago.

                    Comment


                      #11
                      So it's not possible to use Draw.FibonacciRetracements for what i want to do. There is no way i can get a barAgo for a price that is not link to a barAgo.

                      Comment


                        #12
                        Helllo frankduc,

                        Most of the drawing tools work based off of bars ago or DateTimes, you need to know what point in time you want to draw objects. The only way to use only a price would be something like a horizontal line which just requires a price and is not associated with a specific part of the chart.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        649 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        370 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        109 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        574 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        576 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X