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 Irukandji, Today, 05:50 AM
          0 responses
          1 view
          0 likes
          Last Post Irukandji  
          Started by ageeholdings, Today, 05:22 AM
          0 responses
          5 views
          0 likes
          Last Post ageeholdings  
          Started by llanqui, 04-28-2024, 10:32 AM
          2 responses
          18 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by DroneBlackCa, Today, 05:17 AM
          0 responses
          3 views
          0 likes
          Last Post DroneBlackCa  
          Started by tradingnasdaqprueba, 04-09-2024, 09:52 AM
          7 responses
          50 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X