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 TraderBCL, Today, 04:38 AM
                2 responses
                6 views
                0 likes
                Last Post TraderBCL  
                Started by martin70, 03-24-2023, 04:58 AM
                14 responses
                105 views
                0 likes
                Last Post martin70  
                Started by Radano, 06-10-2021, 01:40 AM
                19 responses
                606 views
                0 likes
                Last Post Radano
                by Radano
                 
                Started by KenneGaray, Today, 03:48 AM
                0 responses
                4 views
                0 likes
                Last Post KenneGaray  
                Started by thanajo, 05-04-2021, 02:11 AM
                4 responses
                471 views
                0 likes
                Last Post tradingnasdaqprueba  
                Working...
                X