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

? Price = 0.75

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

    ? Price = 0.75

    I'm fairly new to coding, I'm trying to Draw a dot above High[0] == 0.75 Price, lets say every price that has a High of 0.75 of a price, say 1245.75 any suggestions

    This is what I have so far:

    if (High[0] == 0.75)
    {
    DrawDot("My dot" + CurrentBar, false, 0, High[0] + TickSize, Color.Red);
    }
    Last edited by sunfirerv; 10-01-2015, 06:19 AM.

    #2
    Hello sunfirerv,

    Thanks for your post.

    You'll want to convert the double price to integer by casting to drop the decimal.

    Code:
    int highprice = (int)High[0];
    
    if ( High[0] - highprice == 0.75)
    {
    DrawDot("My dot" + CurrentBar, false, 0, High[0] + TickSize, Color.Red);
    }
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Really new, not sure how to do that?

      Comment


        #4
        Hello sunfirerv,

        Thanks for your reply.

        This line: int highprice = (int)High[0]; Creates an integer (whole number) variable named highprice. (int)High[0] casts the integer value of the currentbars High value into highprice.

        The next statement, if ( High[0] - highprice == 0.75) subtracts the whole number highprice from the decimal value of High[0] and then tests to see if 0.75 remains.

        Here is a reference: http://www.dotnetperls.com/cast-int
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks very much.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by sidlercom80, 10-28-2023, 08:49 AM
          169 responses
          2,269 views
          0 likes
          Last Post QuantKey_Bruce  
          Started by Irukandji, Yesterday, 02:53 AM
          2 responses
          17 views
          0 likes
          Last Post Irukandji  
          Started by adeelshahzad, Today, 03:54 AM
          0 responses
          3 views
          0 likes
          Last Post adeelshahzad  
          Started by CortexZenUSA, Today, 12:53 AM
          0 responses
          3 views
          0 likes
          Last Post CortexZenUSA  
          Started by CortexZenUSA, Today, 12:46 AM
          0 responses
          1 view
          0 likes
          Last Post CortexZenUSA  
          Working...
          X