Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get price

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

    Get price

    Hello, I am looking for a way to code a long limit order where the price I want to set is a certain number of ticks (set by a variable) off the close of the previous bar. Can you direct me to any instructional material that can help me ... thank you!

    #2
    Hello pman777,
    Thanks for writing in and I am happy to assist you.

    The following code places a buy order 5 ticks below the previous bars close
    Code:
    EnterLongLimit(Close[1] - 5 * TickSize);


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      thank you!!!

      Comment


        #4
        hi, another question ...

        I'm evaluating a specific condition set associated with the current bar and when the conditions are met, I want to paint a diamond below the bar AND place a limit order several tics above the low of that same bar. My problem is that the triangle does print on the current bar, as expected, BUT my limit order executes on the next bar. I want to order to execute on the same bar as the one the diamond was printed beneath. I'm using a 6 range chart, and I've set CalculateOnBarClose to false. Below is a section of the code that's in question ... appreciate your help!

        {
        DrawDiamond("My Tag" + CurrentBar, true, 0, Low[0] - (10 * TickSize), Color.Black);
        EnterLongLimit(Low[0] + (5 * TickSize));
        }

        Comment


          #5
          Hello pman777,
          Are you getting the limit order filled on historical data (like during backtest)?
          In backtest the orders are filled on the end of the bar (CalculateOnBarClose = true).

          Please let me know if I can assist you any further.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            hmmm ... that may be it ... however, I'm not doing a backtest ... I'm running the strategy in a live connection but looking back 2 days in the charts. I haven't seen my conditions met in real time yet.

            Comment


              #7
              is Market Replay considered historical data too?

              Comment


                #8
                Originally posted by pman777 View Post
                is Market Replay considered historical data too?
                Only the data that is loaded up by NT prior to the set replay start date / time.

                The data / ticks seen live in replay would be be able to run scripts using CalculateOnBarClose = false.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                579 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                334 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                554 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                551 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X