Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Management

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

    Order Management

    Hey,

    Does this following line refer to the sim account or just a live account position?

    Code:
    // If the strategy has terminated reset the strategy id
                else if (atmStrategyId.Length > 0 && GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat)
    Print("Idle");
    It seems to print "idle" on every bar update even when the dom is in a trade
    Last edited by cirion; 12-17-2008, 10:39 PM.

    #2
    Hello,

    This condition will evaluate to true when you are in an ATM strategy
    "atmStrategyId.Length > 0" since the length of the array will always be greater than zero if you HAVE an ATM. This link will help:


    In this condition remove the Cbi portion "GetAtmStrategyMarketPosition(atmStrategyId) == Cbi.MarketPosition.Flat". This link will help:



    Remember your conditions will only evaluate properly if you have a valid id in your atmStrategId variable.
    DenNinjaTrader Customer Service

    Comment


      #3
      How do i cancel a pending order if price has gone X far? I enter the trade with this statement.

      Code:
      AtmStrategyCreate(Action.Sell, OrderType.Limit, Close[0], 0, TimeInForce.Day, orderId, "atmtemplatename", atmStrategyId);
      Another question i have is i want to do a no trade zone around the PP, GAP, S1 etc. While this code works i feel it is very inefficient any suggestions of a better way to go about it?

      Code:
      && (Close[0] < (SessionPivotsDaily_V4(HLCCalculationMode.CalcFromIntradayData, true, 30).PP[0] - 2.25) || (Close[0] > (SessionPivotsDaily_V4(HLCCalculationMode.CalcFromIntradayData, true, 30).PP[0] + 2.25)))
      Thanks for your help
      Last edited by cirion; 12-23-2008, 04:15 AM.

      Comment


        #4
        Hello,


        When you use ATM in NinjaScript you need to first build the template in the DOM then access it via the name within AtmStrategyCreate():


        Then cancel it via AtmStrategyCancelEntryOrder():


        If you are not sure how to build your request in the DOM use this link below. You want to enter a profit target or stop loss parameter:



        For the no trade zone, your code looks fine. What do you feel needs improvement? Is this a condition for when NOT to trade or when TO trade; that will make all the difference of course.
        DenNinjaTrader Customer Service

        Comment


          #5
          Thanks ben i will look into the atm side after work today.

          For the no trade zone, your code looks fine. What do you feel needs improvement? Is this a condition for when NOT to trade or when TO trade; that will make all the difference of course.
          I am after a no trade zone like 2pts (on the ES) around the PP, S1 S2 etc While the code will work i feel it would be better to set the PP, S1 etc numbers as a variable or put all the numbers that are in the no trade zone into an array and call against that instead of calling an indicator to do the maths again for it.

          Hope that made sense.

          Comment


            #6
            You will just have to program yourself the condition not to enter when the price is around there.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              You will just have to program yourself the condition not to enter when the price is around there.
              Can something like this be done josh?

              private string = SessionPivotsDaily_V4(HLCCalculationMode.CalcFromI ntradayData, true, 30).PP

              Comment


                #8
                Likely not. Whatever indicator you are using is not a string. It will most likely be a double value.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Firstly thanks ben and josh for all your help so far.

                  I am having trouble finding the syntax to use in the following code(replacing PendingLimitPrice). The goal is if at close of bar price is 1.25ticks above the limit order (so not filled) created by
                  AtmStrategyCreate to cancel it
                  Code:
                  if (status[2] == "Working")
                   && (Close[0] > PendingLimitPrice + 1.25))
                     {
                        AtmStrategyCancelEntryOrder(orderId);
                        Print("Order Cancelled" );
                     }

                  Comment


                    #10
                    Hi cirion, you could save your limit entry price to a variable (your PendingLimitPrice) when you call the AtmStrategyCreate(). Then your cancel logic you posted should work.

                    Comment


                      #11
                      Originally posted by NinjaTrader_Bertrand View Post
                      Hi cirion, you could save your limit entry price to a variable (your PendingLimitPrice) when you call the AtmStrategyCreate(). Then your cancel logic you posted should work.
                      Thank you heaps it is working perfect now

                      Comment


                        #12
                        Can you use the || in a statement like this?

                        Code:
                        ((Close[0] < (PP - 1.25) || Close[0] > (PP + 1.25)) || (Close[0] < (S1 - 1.25) || Close[0] > (S1 + 1.25)) || (Close[0] < (S2 - 1.25) || Close[0] > (S2 + 1.25)))
                        Trying to create a no trade zone around the major support and resistance levels.

                        Thanks in advance

                        Comment


                          #13
                          Sure you can use the 'or else' like this cirion. You may want to express the no trade zone in terms of TickSize, this way you create more universal code working the same on more products.

                          Comment


                            #14
                            Originally posted by NinjaTrader_Bertrand View Post
                            Sure you can use the 'or else' like this cirion. You may want to express the no trade zone in terms of TickSize, this way you create more universal code working the same on more products.
                            Thanks your reply was most helpful

                            I will do that TickSize changes to

                            Comment


                              #15
                              Does not work how i want it to, so i guess it is back to the drawing board for the deadzone.

                              It appears to not work at all in this form returns true all the time unless i am missing something.

                              Code:
                              ((Close[0] < PPLow || Close[0] > PPHigh) || (Close[0] < S1Low || Close[0] > S1High) || (Close[0] < S2Low || Close[0] > S2High))
                              I am thinking putting all price numbers into an array and do a Close[0] is not in array approach.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              558 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              324 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
                              545 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              547 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X