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

Not Plotting

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

    Not Plotting

    I'm new to coding strategies and indicators..

    I ran through the strategy builder to test a simple feature like plotting an up arrow when the bar closes when the close is higher than the open price..

    But It's not plotting anything on the chart...

    Here is the code the builder produced.


    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 0)
    return;

    // Set 1
    if (Close[0] > Open[0])
    {
    Draw.ArrowUp(this, @"MyPlotTest Arrow up_1", false, 0, 0, Brushes.Lime);
    }



    And another simple question is the price chart the chart where the candle sticks are? and is the indicator chart a different panel?


    Thanks
    Bruce

    #2
    Hello traderhawk,
    Price panel is where the candlesticks are & other panels can be indicator panels e.g. RSI is plotted on new lower panel. You code should draw 1 Arrow Up but it will be drawn @ 0 level, you can go to Drawing Objects to see it. Either you can change auto scale from drawing objects or code itself so then it will be visible on your chart.
    Generally we keep the chart markers near price so that they are visible e.g. Low[0] or High[0]. If you need multiple markers then make the tag dynamic by adding CurrentBar in tag name.
    Hope it helps!

    Comment


      #3
      Ok thanks for the clarity on where you see the drawing objects..

      But why doesn't the code I posted which was generated from the strategy builder work? Is there more code required?

      Looking at the reference docs..and looking at some syntax options ..

      Draw.ArrowUp(NinjaScriptBaseowner, string tag, bool isAutoScale ,int barsAgo, double y, Brush brush, bool drawOnPricePanel)

      Do I need to tell NT what Panel to place the draw object? Then why wouldn't the strategy builder know that? Or do I have to tell it..

      It's a little confusing as not many samples..

      I tried this as well and still didn't work...

      Draw.ArrowUp(this,@"MyPlotTest Arrow up_1", true, 0, Low[0]-TickSize, Brushes.Lime, true);
      Last edited by traderhawk; 07-15-2021, 09:53 PM.

      Comment


        #4
        Hello traderhawk,
        You don't need to specify any panel or extra code for this. Let me attach a sample code for drawing Arrow Up. Just in case you don't see the arrows, be sure to enable the Strategy either from Strategies dialog or Control Center - Strategies.
        Hope it helps!
        Attached Files

        Comment


          #5
          Thanks Heaps.. S.Kinra.. I had to enable the strategy in the control center under the Strategies TAB... I also used your code and works well thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by alifarahani, Today, 09:40 AM
          4 responses
          20 views
          0 likes
          Last Post alifarahani  
          Started by gentlebenthebear, Today, 01:30 AM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by PhillT, Today, 02:16 PM
          2 responses
          7 views
          0 likes
          Last Post PhillT
          by PhillT
           
          Started by Kaledus, Today, 01:29 PM
          3 responses
          11 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by frankthearm, Yesterday, 09:08 AM
          14 responses
          47 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Working...
          X