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

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

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by kaywai, 09-01-2023, 08:44 PM
                5 responses
                601 views
                0 likes
                Last Post NinjaTrader_Jason  
                Started by xiinteractive, 04-09-2024, 08:08 AM
                6 responses
                22 views
                0 likes
                Last Post xiinteractive  
                Started by Pattontje, Yesterday, 02:10 PM
                2 responses
                17 views
                0 likes
                Last Post Pattontje  
                Started by flybuzz, 04-21-2024, 04:07 PM
                17 responses
                230 views
                0 likes
                Last Post TradingLoss  
                Started by agclub, 04-21-2024, 08:57 PM
                3 responses
                17 views
                0 likes
                Last Post TradingLoss  
                Working...
                X