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

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?
    JesseNinjaTrader Customer Service

    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.

        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            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)
                JesseNinjaTrader Customer Service

                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.
                    JesseNinjaTrader Customer Service

                    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.
                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by set2win, 08-04-2021, 09:23 AM
                        39 responses
                        1,000 views
                        0 likes
                        Last Post WaleeTheRobot  
                        Started by md4866, Today, 08:15 PM
                        0 responses
                        6 views
                        0 likes
                        Last Post md4866
                        by md4866
                         
                        Started by mjbatts91, Yesterday, 04:48 PM
                        2 responses
                        23 views
                        0 likes
                        Last Post mjbatts91  
                        Started by pibrew, Today, 06:10 PM
                        1 response
                        19 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by actualfacts.2021, 07-25-2021, 03:11 PM
                        8 responses
                        1,187 views
                        0 likes
                        Last Post linkcou
                        by linkcou
                         
                        Working...
                        X