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 yertle, Yesterday, 08:38 AM
          7 responses
          28 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by bmartz, 03-12-2024, 06:12 AM
          2 responses
          21 views
          0 likes
          Last Post bmartz
          by bmartz
           
          Started by funk10101, Today, 12:02 AM
          0 responses
          4 views
          0 likes
          Last Post funk10101  
          Started by gravdigaz6, Yesterday, 11:40 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by MarianApalaghiei, Yesterday, 10:49 PM
          3 responses
          10 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X