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

DrawDot causing a problem

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

    DrawDot causing a problem

    Hi,

    I have an indicator looking for a condition which appears to be working as I have the if statement followed by a print which when the if statement is true I am seeing the correct output as per the code below;

    Code:
    This is when the code was working correctly;
    if (BarsInProgress == 0)
    {
    if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
    print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
    }
    However when I have attempted to add a DrawDot after the condition as well I am seeing a problem. The problem is the print output is now printing everything in the print statement even when the condition is not true. What could be causing this?

    Code:
    if (BarsInProgress == 0)
    {
    if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
    print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
    DrawDot("Plot0", false, 0, High[0] + 1, Color.WhiteSmoke);
    }
    Appreciate the help.

    #2
    suprsnipes, you extended your if ( ) condition beyond using a single line, so you would need to use the { } braces around it -

    Code:
    if (BarsInProgress == 0)
    {
    if (GetCurrentBidVolume(0) > GetCurrentAskVolume(1))
     {
       print(GetCurrentBidVolume(0) + " " + GetCurrentAskVolume(1))
       DrawDot("Plot0", false, 0, High[0] + 1, Color.WhiteSmoke);
     }
    }
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Could you please confirm that for DrawDot etc there is no need to use Add() in the Initialize section?

      Comment


        #4
        Correct, that's not need to work with DrawDot() per se, only if you would want to add

        a) bars series for programmatic access
        b) indicators for display in strategies
        c) adding a plot / line (which does not relate to the drawing methods)
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Appreciate it your quick response as always, thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X