Announcement

Collapse
No announcement yet.

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 DeskTroll, Today, 12:09 PM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by Pabulon, 12-02-2024, 03:42 PM
          14 responses
          90 views
          0 likes
          Last Post Pabulon
          by Pabulon
           
          Started by tfa2806trader, Today, 12:04 PM
          10 responses
          25 views
          0 likes
          Last Post tfa2806trader  
          Started by trdninstyle, 11-26-2024, 12:23 PM
          62 responses
          186 views
          0 likes
          Last Post trdninstyle  
          Started by lorien, 08-08-2021, 07:33 AM
          12 responses
          722 views
          0 likes
          Last Post AndyM871  
          Working...
          X