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

Changing Limit order to Price level

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

    Changing Limit order to Price level

    Hello,Support!

    My strategy has two options for Market and Limit orders and initiates both or just Market or just Limits(by choice).the question is how do i change the Limit order for the price level,where the limit is supposed to be,but i don`t want it to be placed,but instead the price to touch that level?

    The logic is when the Limit orders are filled,the stops levels adjusts,so i just want the price level to be touched to adjust the stop without Limits being filled.

    Thank you

    #2
    Hello outsource,

    Thanks for your post.

    I do not understand what you are asking for but it sounds like you are wanting to monitor the price and then adjust your limit order?

    You may want to add some clarity with a screenshot illustrating what you want to do.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello outsource,

      Thanks for your post.

      I do not understand what you are asking for but it sounds like you are wanting to monitor the price and then adjust your limit order?

      You may want to add some clarity with a screenshot illustrating what you want to do.
      Hi,Paul,

      No,i want to adjust stop and profit taking when the level is reached.I have so far the limit order in place along side the market order,that triggers the adjustment,but i dont want the additional dangling order,as i have the profit and stops the same size.So,when the limit is triggered i have the target nearby the entry(1+tick),but stop adjusts just slightly to avoid slippage and latency etc cetera...All in all,when i have the limit triggerd,i have two orders where the target is one tick,but the stop is slightly more,so what i need now,is to get rid of the limit order and to keep just the price ;evel instead,so when the price level is triggered it would be equal to the limit order,only the limit won`t be filled now.

      I can provide the snippet from the execution framework if necessary.

      Comment


        #4
        Hello outsource,

        Thanks for your reply.

        It sounds like you need not submit the Profit Target and just use a double to track what price it would be at.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hey,guys,

          here is the snippet in which i need a change:

          Code:
          if(this.iFirstOrderType == eFirstOrderType.MARKET)
          							{								
          								if(Position.MarketPosition == MarketPosition.Long)
          								{
          									for(int i = 0 ; i < tVars.qty.Length ; i++)
          									{
          										double oPrice = Position.AvgPrice - (Position.AvgPrice * (tVars.interval[i] / 100));
          										if(tVars.qty[i] != 0)									
          											tVars.iFillOrders.Add(SubmitOrder(sBIP, OrderAction.Buy, OrderType.Limit, tVars.qty[i], oPrice, 0, string.Empty, "Lmt_" + (i+1).ToString()));									
          									}
          								}
          I assume i need this line to exchange on just the price at this level,without the Limit order being submited:

          Code:
          tVars.iFillOrders.Add(SubmitOrder(sBIP, OrderAction.Buy, OrderType.Limit, tVars.qty[i], oPrice, 0, string.Empty, "Lmt_" + (i+1).ToString()));
          How can i do it?I can provide additional info, if needed.

          Thank you!
          Last edited by outsource; 06-07-2016, 08:46 PM.

          Comment


            #6
            Hello outsource,

            You would compare the oPrice to the current price and then submit, or not, the order.
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Paul View Post
              Hello outsource,

              You would compare the oPrice to the current price and then submit, or not, the order.
              Hi,Paul,could you post an example,please?

              Comment


                #8
                Hello outsource,

                Thanks for your post.

                An example would be if-then-else statement.

                if (condition to be evaluated)
                {
                // take some action if evaluated condition is true
                }
                else
                {
                // take other action if evaluated condition false
                }

                reference: http://ninjatrader.com/support/helpG...g_commands.htm
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Paul View Post
                  Hello outsource,

                  Thanks for your post.

                  An example would be if-then-else statement.

                  if (condition to be evaluated)
                  {
                  // take some action if evaluated condition is true
                  }
                  else
                  {
                  // take other action if evaluated condition false
                  }

                  reference: http://ninjatrader.com/support/helpG...g_commands.htm
                  Still hard to get,as im not a programmer,but try to guess:

                  Will that one work?

                  Code:
                  for(int i = 0 ; i < tVars.qty.Length ; i++)
                  									{
                  										double oPrice = Position.AvgPrice - (Position.AvgPrice * (tVars.interval[i] / 100));
                  										if(tVars.qty[i] != 0)									
                  											tVars.iFillOrders.Add(SubmitOrder(sBIP, OrderAction.Buy, OrderType.Limit, tVars.qty[i], oPrice, 0, string.Empty, "Lmt_" + (i+1).ToString()));	
                  										else if(tVars.qty[i] == 0)
                  											double oPrice = Position.AvgPrice - (Position.AvgPrice * (tVars.interval[i] / 100));
                  											
                  									}

                  But it doesnt compile.Please,corret me.

                  Comment


                    #10
                    Hello outsource,

                    Thanks for your reply.

                    Here is another example you might consider:

                    double myPriceProfitLevel = 1200; // this is just an example variable use your oPrice here instead

                    if (Position.MarketPosition == MarketPosition.Long
                    && Close[0] >= myPriceProfitLevel)
                    {
                    // adjust your stop order
                    }
                    if (Position.MarketPosition == MarketPosition.Short
                    && Close[0] <= myPriceProfitLevel)
                    {
                    // adjust your stop order
                    }

                    Please note that NinjaTrader does not provide coding or debugging services. We can provide references to 3rd party coders that can assist you with these needs upon your request.
                    Paul H.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Paul View Post
                      Hello outsource,

                      Thanks for your reply.

                      Here is another example you might consider:

                      double myPriceProfitLevel = 1200; // this is just an example variable use your oPrice here instead

                      if (Position.MarketPosition == MarketPosition.Long
                      && Close[0] >= myPriceProfitLevel)
                      {
                      // adjust your stop order
                      }
                      if (Position.MarketPosition == MarketPosition.Short
                      && Close[0] <= myPriceProfitLevel)
                      {
                      // adjust your stop order
                      }

                      Please note that NinjaTrader does not provide coding or debugging services. We can provide references to 3rd party coders that can assist you with these needs upon your request.
                      Paul,i guess i`d need to replace the iFillOrders with sometthing else,so it just throws the price levels instead of limit orders,and so the strategy could read those levels and adjust the stop and target accordingly.is it ever feasible?

                      Comment


                        #12
                        Hello outsource,

                        There a few ways to approach this. We provided a simpler approach that you can use. You are correct in that you would not use the actual SubmitOrder method to submit the limit orders but rather just use doubles to hold the prices that you would have submitted the limit orders to. Then compare those doubles to the current price as seen in Paul's prior example.

                        Comment


                          #13
                          Originally posted by NinjaTrader_PatrickH View Post
                          Hello outsource,

                          There a few ways to approach this. We provided a simpler approach that you can use. You are correct in that you would not use the actual SubmitOrder method to submit the limit orders but rather just use doubles to hold the prices that you would have submitted the limit orders to. Then compare those doubles to the current price as seen in Paul's prior example.
                          Thanks,Patrick.I got the point,but have difficulties,technically to land that double.Like have errors here and there.Any 3-rd party you can recommend,who would assist?

                          Comment


                            #14
                            Hello outsource,

                            Thank you for the follow up.

                            I have provided a link below that will show you the NinjaTrader Ecosystem partners that provide NinjaScript Consulting services, you will need to contact each partner and inquire further regarding the quotes for prices for your custom NinjaScript ideas and work with the consultant directly:




                            Please let me know if you have any questions, concerns or if I can provide any further assistance by responding to this thread at your convenience.
                            Ryan L.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by futtrader, 04-21-2024, 01:50 AM
                            4 responses
                            41 views
                            0 likes
                            Last Post futtrader  
                            Started by Option Whisperer, Today, 09:55 AM
                            1 response
                            12 views
                            0 likes
                            Last Post bltdavid  
                            Started by port119, Today, 02:43 PM
                            0 responses
                            8 views
                            0 likes
                            Last Post port119
                            by port119
                             
                            Started by Philippe56140, Today, 02:35 PM
                            0 responses
                            7 views
                            0 likes
                            Last Post Philippe56140  
                            Started by 00nevest, Today, 02:27 PM
                            0 responses
                            7 views
                            0 likes
                            Last Post 00nevest  
                            Working...
                            X