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

DrawEllipse

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

    DrawEllipse

    How can I draw an Ellipse around the current bar if I want to leave any space on either side of the bar?

    For example:

    DrawEllipse("mytag", CurrentBar-2, High[0], CurrentBar+2, Low[0], Color.Black)

    will give me an error about startBarsAgo being greater or equal to zero. In order to circle the current bar, it has to be.

    Any suggestions? Am I missing something?

    Thanks.

    #2
    The parameters are looking for "bars ago" and not the bar number. So instead of using CurrentBar - 2 just put in 2.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      That doesn't help me. Specifying 2 only draws on the left side of the current bar. You can't specify a negative number (-2) for the right side of the current bar, hence, I can't draw an ellipse around the current bar, right?

      Comment


        #4
        Unfortunately this is not possible at this time.
        RayNinjaTrader Customer Service

        Comment


          #5
          Ellipse

          Originally posted by NinjaTrader_Ray View Post
          Unfortunately this is not possible at this time.


          I'm trying this:
          Code:
          DrawEllipse("ellipse"+CurrentBar,true,(indexa-1),High[indexa]+5*TickSize,(indexa+1),Low[indexa]-5*TickSize,Color.Navy,Color.Gold,3);
          Any way to draw this without the error apparently induced by the
          Code:
          (indexa+1)
          ??

          Comment


            #6
            Hello zeller4,

            Thank you for your post.

            You could use the following but keep in mind the -1 value would need a bar to pull from so this would need to be when using CalculateOnBarClose = true:
            Code:
            			if (CurrentBar <= 1)
            				return;
            			
                        DrawEllipse("tag", 1, Close[1], -1, Close[-1], Color.Black);
            You may wish to look into custom drawing. An example can be found under Tools > Edit NinjaScript > Indicator > CustomPlotSample. This shows how to override the Plot method for custom drawing.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by AttiM, 02-14-2024, 05:20 PM
            12 responses
            213 views
            0 likes
            Last Post DrakeiJosh  
            Started by cre8able, 02-11-2023, 05:43 PM
            3 responses
            238 views
            0 likes
            Last Post rhubear
            by rhubear
             
            Started by frslvr, 04-11-2024, 07:26 AM
            8 responses
            117 views
            1 like
            Last Post NinjaTrader_BrandonH  
            Started by stafe, 04-15-2024, 08:34 PM
            10 responses
            47 views
            0 likes
            Last Post stafe
            by stafe
             
            Started by rocketman7, Today, 09:41 AM
            3 responses
            12 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X