Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Builder, Fib drawing, set End Y at 50% between two bars

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

    #16
    I did get sarcastic at the end, I apologize for that.

    Where it says, string tag, I don't literally say 'string tag' it's just showing me that my string tag, which is "SupportResistance Fibonacci retracements_1" goes in that spot. And all the other strings that I may attach to it, like current bar sometimes.

    bool isAutoScale, in which is true or false, which I have false, I don't literally say bool isAutoScale, correct? It's just describing that my false statement is auto scaling. (Thats how I'm reading this)

    The int startBarsAgo, is simply just the (3) & int endBarsAgo, (1), how far out for the drawing.
    NinjaScriptBase owner is simply the 'this' .

    I'm missing one more argument which is, double startY so I don't literally say double startY, I put the correct piece of math there?
    Which is High[3] and double endY is actually Low[1].

    Am I interpreting this right? Thanks, sorry I got sarcastic.

    Comment


      #17
      Okay, now I'm getting it. I didn't compile yet.
      Attached Files

      Comment


        #18
        I'm overloaded with arguments though, I see that I have 7 arguments but it says I can only have 5.
        Attached Files

        Comment


          #19
          It compiled but is it still right? I placed more brackets, you'll see in the pic.
          I know it's not right, it won't apply when I load it.
          Attached Files
          Last edited by trdninstyle; 10-24-2024, 09:08 AM.

          Comment


            #20
            No worries. Given the provided parameters, this is how you should call the draw method:

            Draw.FibonacciRetracements(this, ​"SupportResistance Fibonacci retracements_1"​, false, 3, High[3], 1, (High[3] + Low[1]) * 0.5);

            Comment


              #21
              That was wonderful. It took me a little bit to understand it all and now it's drawing a fib from a high to middle of the gap.

              Thank you very much Gaby.

              Maybe my next hurdle won't be such a hill. Okay, the fib is being drawn based on the default at the time. I can call a specific color & style for how it draws separate from my default at the time.
              I change my defaults around often but want to keep that fib drawing the same.

              I can do this, right? Thank you again
              Attached Files

              Comment


                #22
                Something's off on the math Gaby,

                I'm trying to get the fib to draw from the low of bar 3 to the center of the gap, gap between the high of bar 3 & low of bar 1.

                double startY (low of bar 3) to double endY center of gap. It was drawing from the low to the high finding the center of that. Do I need to first identify the center of the gap?

                In my last pic I gave you the wrong one, that was bearish gaps. Didnt do anything with that yet at that time.
                Last edited by trdninstyle; 10-24-2024, 11:06 AM.

                Comment


                  #23
                  We're good to go, I goofed up. I was placing the bull case in with the bear case. My bad.

                  But now can I put in certain parameters for what the fib would look like? Colors, style, apart from my actual default fib.
                  I can make a new request for that Gaby. On a different day though.
                  Attached Files
                  Last edited by trdninstyle; 10-24-2024, 11:33 AM.

                  Comment


                    #24
                    Hello,

                    You could use this overload which allows you to supply a drawing tool template to use:

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

                    Save a template for the FibonacciRetracements with the color you want to use, then you can supply the name of that template to the method.

                    Comment


                      #25
                      Very interesting, I'll try that. bool isGlobal, I don't have to worry about that?

                      I discovered something else in my draw, bar 2 was higher than bar 3 (outside bar), it's better to draw from the highest between the two. Would that be an else situation?
                      High[3] else High[2] is higher.

                      I appreciate ya,

                      Comment


                        #26
                        At first I put string AutoFib (my template name) then just AutoFib, I did put a boolean as false, so it wouldn't always draw.
                        so I have it saying doesn't exist in current content.
                        Attached Files

                        Comment


                          #27
                          isGlobal determines if the draw object will be global across all charts which match the instrument. Specify true or false.

                          Yes that would be and if/else statement.

                          This is a string parameter so if the template name is AutoFib then you need to enclose it quotation marks, i.e. "AutoFib".

                          Comment


                            #28
                            Okay "AutoFib" because it's a string ""

                            I put true for the isGlobal, if I run it on other charts I would want it on those charts, that template.

                            it's saying isGlobal is out of context.
                            Attached Files

                            Comment


                              #29
                              Hello,

                              You haven't put true for isGlobal in this screenshot, you have literally typed in isGlobal for the parameter.

                              isGlobal is a bool parameter, meaning you need to use true or false.

                              Comment


                                #30
                                oh, okay. I fixed it & it compiled. I thought I had to write in isGlobal & say true before that.
                                It draws on the chart per that template after I changed the default to something else.

                                Perfect now. Thank you, thank you

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by CarlTrading, 03-31-2026, 09:41 PM
                                1 response
                                81 views
                                1 like
                                Last Post NinjaTrader_ChelseaB  
                                Started by CarlTrading, 04-01-2026, 02:41 AM
                                0 responses
                                42 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CaptainJack, 03-31-2026, 11:44 PM
                                0 responses
                                64 views
                                2 likes
                                Last Post CaptainJack  
                                Started by CarlTrading, 03-30-2026, 11:51 AM
                                0 responses
                                66 views
                                0 likes
                                Last Post CarlTrading  
                                Started by CarlTrading, 03-30-2026, 11:48 AM
                                0 responses
                                54 views
                                0 likes
                                Last Post CarlTrading  
                                Working...
                                X