• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order placement problem

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

    Order placement problem

    Hello Support!


    I have a big problem with opening some trades. There is an very unusually behevior of it usaully overnight. My broker is MBT and I'm using live license, and when my strategie will close an opened trade, and open a new trade (EnterLong, and EnterShort), then the NT won't close and open, but at my broker will be sended this request, aonly the open order and without close order. As can be seen on the picture.
    I trace the orders and I get this:
    2012.08.30. 1:45:01 Entered internal PlaceOrder() method at 2012.08.30. 1:45:01: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=38 000 LimitPrice=0 StopPrice=0 SignalName='SHORT_4' FromEntrySignal=''

    and:
    2012.08.30. 2:42:00 Entered internal PlaceOrder() method at 2012.08.30. 2:42:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=38 000 LimitPrice=0 StopPrice=0 SignalName='SHORT_4' FromEntrySignal=''

    (the number of short will increase in OnExecution)
    So, this is logged in output window. But! In MBT orderbook there is information about this as can be seen on the pic. that my broker filled my straegie generated open order without close order, but in the NT execuiton tab there isn't information about his!!! I tried to monitor the trade, and in this case I don't receive any information from OnOrder and OnExecution not at all only from OnBarUpdate. But, the NT can appreciate that the quantitiy of position is amended since in the NT execution tab the position at the next successfully opening will delay with this opened quantity. Namely at his attached sample, my strategie send an open trade at 1:44:56 of 38.000 unit, and the NT won't open it, but this will send to the market, and at MBT will filled, TWICE, insteed of 1! And the next successfully opened/closed trade position will amended with 2x38.000 Short Position. In chart and in the Exec Tab and Orders Tab there isn't any information about this order,weather is it opened or rejected... Completely nothing.
    This generate an big problem: the strategie position and account position is comlpetly different, so it isn't avaible to trade hereafter as expected.
    But, In the Log tab all information about this trade is loged and all information is matched up with information at MBT. I attached this.
    I totally pull a long face about it what it is, and what can fix it.
    Please help me!
    Thanks. Ron
    Attached Files
    Last edited by rontrade; 08-31-2012, 09:31 AM.

    #2
    Hello,

    I see the Short order get filled at the time it was submitted:

    2012.08.30. 1:45:01 Entered internal PlaceOrder() method at 2012.08.30. 1:45:01: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=38 000 LimitPrice=0 StopPrice=0 SignalName='SHORT_4' FromEntrySignal=''

    And here is the order ID spawned from this:

    2012.08.30 1:45 Order Order='25pe62s:0aot/*****' Name='SHORT_4' New state=Filled Instrument='$EURUSD' Action=SellShort Limit price=0 Stop price=0 Quantity=38 000 Type=Market Filled=38000 Fill price=1,25252 Error=NoError Native error=''
    2012.08.30 1:45 Position Instrument='$EURUSD' Account='******' Avg price=1,25252 Quantity=38 000 Market position=Short Operation=Insert Currency=UsDollar


    Can you clarify more on what exactly is the issue past this point?

    -Brett
    BrettNinjaTrader Product Management

    Comment


      #3
      Hello Brett

      This is very simple: I have an Long position of 38.000 Unit (as can be seen the attached picture at 1 post), and at custom conditinal I use EnterShort() of 38.000 Unit. At normally cases the EnterShort closes the opened Long position, and opens an short position. Thats all at this point what I'd like. Do you have any idea?

      Comment


        #4
        So are you saying that when EnterShort() is called it works.

        However it does not reverse you out of the long position you had and instead puts you back to flat on your account?

        -Brett
        BrettNinjaTrader Product Management

        Comment


          #5
          There is time when it doesen't work at EnterShort() and EnterLong() properly. I dont't why. As can you see at attached picture, I have an long position of 38.000 Unit. It was opened by EnterLong() and reverse an short position of 38.000 unit. At the problem point is when I want to close this existing long position and reverse using EnterShort() of 38.000 Unit. But the NT doesen't reverse the position, it makes this way: the long position is still live in NT, it doesen't close using Sell, insteed of open short position twice of 2x38.000 (76.000) Unit, that is send to MBT, and at MBT I have Short of 38.000 Unit ( Long of 38.000 Unit - Short of 76.000 Unit = Short 38.000 Unit), but in NT is still Long of 38.000 Unit. (this can be monitoring at MBT, but in NT order tab there isn't info about it) This happen again at 2:41:55, so my account position is (Short 38.000 + Short 38.000) Short of 76.000 Unit at MBT, and my strategie position at NT is still Long of 38.000 Unit. When this NT Long position of 38.000 Unit will close as in my case (it has stopped), it will sell of 38.000 Unit. that is added to existing account position: S76.000 + S38.000. So at Strategie position is Flat, while account position is Short of 114.000 Unit (76+38). The other problem is, the strategie always calculates a stop that quantity is equal with position quantity. So if I want to stop 38.000 Unit to get a flat position, at MBT won't flat this position never.
          I hope it was clear. Ron
          Attached Files

          Comment


            #6
            But the NT doesen't reverse the position, it makes this way: the long position is still live in NT, it doesen't close using Sell, insteed of open short position twice of 2x38.000 (76.000) Unit, that is send to MBT, and at MBT I have Short of 38.000 Unit ( Long of 38.000 Unit - Short of 76.000 Unit = Short 38.000 Unit), but in NT is still Long of 38.000 Unit.
            We need to isolate this sentence here, now we need an exact sequence of events of this sentence.

            Specifically you say "but in NT is still long of 38,000 unit". What specifically you say here the strtegies position shows this in the strategies tab or the account shows this in the positions tab?

            -Brett
            BrettNinjaTrader Product Management

            Comment


              #7
              Originally posted by NinjaTrader_Brett View Post
              We need to isolate this sentence here, now we need an exact sequence of events of this sentence.

              Specifically you say "but in NT is still long of 38,000 unit". What specifically you say here the strtegies position shows this in the strategies tab or the account shows this in the positions tab?

              -Brett
              Hello Brett,

              Yes, the position is still Long of 38.000 Unit in NT, in spite of the open order is submitted in question, and the account position at MBT is amended by this order (only the close value). I plotted in output window, and on chart (using DrawTextFixed()) the actual position using this method: Position.MarketPosition. And when I'd like to close this position or send an stoploss I refer to this. But, in the strategies tab doesen't reflect the right position of Positions tab, as can be seen on picture: open picture 4, therefore I don't deal with it. The datas on Position tab was equal with the MBT ordersbook positions for a while, but I can't make head or tail of it. 1 stragegie runs on for individual FX chart, with 4 in individual position, but there is more than 4 position in Positions tab, as can be seen on open picture 3. Please look at a moment on it! I can't interpret this. So I can use only the value of Position.MarketPosition, and the account position at MBT.
              At he moment reflect the attached picture. The actual positions, inquire using Position.MarketPosition , account position, Positions tab are:
              Position.MarketPosition MBT Positions tab
              EURUSD: Long - 37.000 Short - 77.000 Short - 77.0000
              GBPUSD: Long - 31.000 Long - 62.000 Long - 248.000
              USDCHF: Long - 24.000 Short - 70.000 Short - 70.000
              USDJPY: Short - 68.000 Short - 193.000 Short - 376.000
              All datas can be seen on attached picture.
              exact sequence of events:
              1. EnterShort() quant before open: Flat | after: S38.000
              2. EnterLong() (reverse) before: S38.000 | after: L38.000
              3. EnterShort() (in question order, reverse) before: L38.000 | after: L38.000 (In strategie), at MBT S38.000 (2xS38.000)
              4. EnterShort() (in question order, reverse) before: L38.000 | after: L38.000 (In strategie), at MBT S76.000
              5. ExitLongStop() (fromEntrySignal: 2. point) before: L38.000 Unit | After: 0 (strategie), at MBT S114.000

              I hope I'm clear, because of my english isn't so good. :-) Ron
              Attached Files
              Last edited by rontrade; 08-31-2012, 02:41 PM.

              Comment


                #8
                Hello,

                It is difficult to understand based on the language barrier however it all appears to be account position vs strategy position sync issues.

                From what you describe it looks like your account position and the strategy position is not in sync for the order in question.

                Strategy Position vs. Account Position:
                http://www.ninjatrader-support2.com/...ead.php?t=4033

                1st solution:

                You can include the following statement in your code to avoid the strategy to be calculated on historical data.

                // Only run on real-time data
                if (Historical)
                return;
                Add the statement to the top of OnBarUpdate()

                2nd solution:
                You can set 'On starting a real-time strategy' to 'Wait until flat before executing live'.
                This option can be found at Tools-->Options-->Strategies-->NinjaScript-tab.

                3rd solution, would be submitting manual orders to sync the strategy and account positions described in the link

                4th solution, would be to enable Sync account position to true.

                http://www.ninjatrader.com/support/h..._positions.htm
                BrettNinjaTrader Product Management

                Comment


                  #9
                  Hello Brett,

                  I'm sorry for my weak english knowledge . I can't able to all things good to learn. :-)
                  Thanks for advises.
                  I'm understand all things you recommend. The problem isn't created at start. At start I'm using the sync command too. I check the position at NT and at MBT that are absolutelly Flat. It runs perfectly mainly through 1-2 days, and the problem occured overnights, around 2-3 at a clock AM. Then the strategy generate an open trade, that the NT will not open (that signal is opened before), but it is submitted by NT to MBT, where it is opened. So the position still constant at NT, in spite of the position at MBT will amend according to the quantity of open trade in NT.
                  The strategie runs perfectly, its generate the orders as expect, but the NT isn't tend to open the order, when comes the open signal. I spend a lot of time to write a strategie on, I bought the NT for lot of money, and the NT won't works perfectly.... Should I give up to run my strategie in live before the goal? I'm completly helpless what shoul I do? Because of the running of strategie is dangerous this way, I will lose all of my money...

                  Comment


                    #10
                    Hello,

                    What setting are you using for Control Center->Tools->Options->Strategy Tab->NinjaScript sub tab-> for connection loss handling?

                    -Brett
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      Originally posted by NinjaTrader_Brett View Post
                      Hello,

                      What setting are you using for Control Center->Tools->Options->Strategy Tab->NinjaScript sub tab-> for connection loss handling?

                      -Brett
                      Hello Brett,
                      I've attached the picture about this. Maybe it can effect this?
                      Although it is interessant: the cancel entry is off. This behavior is similar as my problem: the exit orders is canceled, the entry not. Can it be, therefore send the NT entry orders, and exit orders not, when it get an reverse signal? (EnterLong()/EnterShort) Ron
                      Attached Files

                      Comment


                        #12
                        Could be relevant.

                        What we need to find out is specifically what changes or what happens over night that causes this.

                        I know that MBT brings accounts offline everynight or makes the unavailable for trading during rollover.

                        I would like to have you send in full trace and logs to support at ninjatrader dot com ATTN: Brett and give me a time and date when the problem occurs so I can review the traces.

                        Control Center->Help->Mail To Support to send the logs and traces in.

                        -Brett
                        BrettNinjaTrader Product Management

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by aviat72, Today, 12:41 AM
                        1 response
                        9 views
                        0 likes
                        Last Post NinjaTrader_ChrisSch  
                        Started by _Zero_, 01-06-2020, 01:16 PM
                        2 responses
                        76 views
                        2 likes
                        Last Post CiprianV  
                        Started by RuthB, 05-29-2020, 09:41 PM
                        3 responses
                        33 views
                        0 likes
                        Last Post aviat72
                        by aviat72
                         
                        Started by Jorge.andres.o, Yesterday, 08:22 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post Jorge.andres.o  
                        Started by mtamaku, Yesterday, 06:54 PM
                        0 responses
                        11 views
                        0 likes
                        Last Post mtamaku
                        by mtamaku
                         
                        Working...
                        X