Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to enter open[0]+10 in a variable?

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

    how to enter open[0]+10 in a variable?

    Hello. My programming knowledge is small. I would appreciate some guidance. I have a button that launches an order at Open[0]+10 ticks. When a new bar is created the order is moved. I know that for it not to move I should include the Open[0]+10 ticks in a variable and place that variable in EnterLongStopLimit((Open[0] + (18 * TickSize)) , (Open[0] + (18 * TickSize )) , "l"); but I am not able to include the Open[0]+10 ticks in a variable. Could you help me a little? thank you.

    #2
    Do you mean you want to store the open only at the open of the day, or at the open of each bar?

    If you mean the open of each bar, it would be like:

    double MyOpenValue = Open[0];

    EnterLongStopLimit(MyOpenValue + 10 * TickSize, "EntryOrderNameHere");

    If you mean the open of each day, and it's a 24-hour chart, you would need to check for the first bar that is after the open and only store it on that bar.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      I want to put it in a bool variable with the intention of turning the variable on and off so that when a new bar is created in 5 minutes the order won't adjust to the new open. Thank you.

      Comment


        #4
        Thank you Bruce for your answer but it doesn't work for me. I am unable to make the order not move while new bars are being created. Can someone tell me how an EnterLongStopLimit order would be that does not move when a new bar is created? thank you

        Comment


          #5
          Hello julifro,

          To make the order not move you need to store the price you want to a variable at a specific point, for example when you first enter. That variable can be used for the orders price so when you re submit it the same price is being used each time you call the order method again. It would only move if you later update that variables price before the order fills.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          132 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          73 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          45 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X