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

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.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by AaronKoRn, Today, 09:49 PM
          0 responses
          6 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          8 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          9 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,975 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X