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 arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            48 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X