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

Drawing object in strategy

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

    Drawing object in strategy

    Hi,

    Can a strategy plot object on the chart? I'm asking because I'm unable to see my object (i.e rectangle) when I'm running the strategy however, I have no problem drawing the same object when I write an indicator.

    Thanks,
    Ofir

    #2
    Hello ofiramitai,

    Thanks for your post.

    Yes, the strategy can use the draw methods to draw on the price panel of the chart.
    If the strategy is not drawing the object when you run, please check your "Log" tab in the NT8 control center for any error messages.

    You may want to use print statements to print the values used to draw the rectangle as well as any values used to decide when to draw the rectangle. Here is a link to our debugging tips: https://ninjatrader.com/support/help...script_cod.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the quick reply.

      I'm using this simple code and I don't see anything on the chart. The Log doesn't say anything either. Any hidden setting I'm missing?

      Print("Start");
      //Draw.Diamond(this, "a" + CurrentBar.ToString(), true, 0, Close[0], Brushes.Red);
      Draw.Dot(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
      Print("End");

      Comment


        #4
        Hello ofiramitai,

        Thanks for your reply.

        Your code looks fine however with the Draw.Dot you will only see the latest one based on the use of the same tag name.
        You may want to move the dot further away from the bar to ensure visibility and/or left click on the bars and then hold down Ctrl and Shift key and use the mouse wheel to scroll through the drawing layers just to ensure the object(s) are not hidden. You may also want to use a different color if your candles/bars are also red.

        You could also create a new strategy with only the draw statements to verify functionality.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks Paul for the reply.

          I'm sorry but I'm totally at a loss. I've reinstalled NT8 and created a new strategy with two lines and I still can't see the shape or text.

          Draw.Diamond(this, CurrentBar.ToString(), true,0, Low[0], Brushes.Red);
          Draw.Text(this, "aaa", "gsg gsgsdggs", 0, 2885);

          Comment


            #6
            Hello Ofir,

            Thanks for your reply.

            I've created a new strategy using your code (modified the Y-axis location for visibility) which I would ask you to download and install and apply to a 1 minute chart of any instrument you have data for.

            Here is what it looks like on my end with ES 09-19 1 minute and what the strategy looks like which is also attached. as you can see the red diamons appear below ever candle. the text is applied to the latest candled above the high of the candle.


            Click image for larger version

Name:	Ofir-1.PNG
Views:	732
Size:	107.0 KB
ID:	1070038

            [ATTACH]n1070039[/ATTACH]


            Please let us know if this does not display on a new chart, without any templates or other indicators applied to it.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              I found my problem thanks to the screenshot you provided. I was adding the strategy using the center window and not the chart.

              Thanks a lot Paul

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by wzgy0920, 04-20-2024, 06:09 PM
              2 responses
              27 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 02-22-2024, 01:11 AM
              5 responses
              32 views
              0 likes
              Last Post wzgy0920  
              Started by wzgy0920, 04-23-2024, 09:53 PM
              2 responses
              49 views
              0 likes
              Last Post wzgy0920  
              Started by Kensonprib, 04-28-2021, 10:11 AM
              5 responses
              193 views
              0 likes
              Last Post Hasadafa  
              Started by GussJ, 03-04-2020, 03:11 PM
              11 responses
              3,235 views
              0 likes
              Last Post xiinteractive  
              Working...
              X