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 chrischongpdx, Today, 09:39 PM
          0 responses
          7 views
          0 likes
          Last Post chrischongpdx  
          Started by Mountain_cast, Today, 12:41 PM
          2 responses
          9 views
          0 likes
          Last Post Mountain_cast  
          Started by dontpanic, 04-07-2015, 04:42 AM
          4 responses
          1,322 views
          0 likes
          Last Post BeachTrader11807  
          Started by algospoke, Today, 07:54 PM
          0 responses
          5 views
          0 likes
          Last Post algospoke  
          Started by Rxxar, Today, 06:26 PM
          0 responses
          10 views
          0 likes
          Last Post Rxxar
          by Rxxar
           
          Working...
          X