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

Wrong Indicated Position

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

    Wrong Indicated Position

    Yesterday I ran a new Strategy I developed with the Unmanaged Approach on a real-money account for the first time. It had been extensively back-tested with a variety of instruments over six-months of Market Replay data plus a few days of real-time trading with a Sim100 account without any error message or apparent malfunction. Yesterday it was configured to trade up to 4 RTY 12-21 contracts. (It scales trade size according to real-time market conditions and a percentage of the current account Excess Intraday Margin, but a fixed limit can be set and that limit was set to 4 contracts.)

    The Strategy went short 4 contracts soon after it was started, prices dropped, it had a profit, and I thought Great - its nice to have the first trade be a winner. Then a few minutes later I noticed NT was showing $4000 Intraday margin (instead of 4 * $500 = $2000) and Chart Trader was showing the position as Short 8 contracts. My Strategy has button that can be clicked to cancel all open orders, exit any existing position with a Market Order, and stop trading. I clicked that button. Almost instantly Chart Trader showed the position was Flat, the displayed Intraday margin became $0.00, and the correct profit amount from being Short 4 contracts (not 8) showed in the PnL field.

    The log shows the initial 4-contract entry order to go Short had a split fill, with a Quantity 1 execution followed within the same second by a Quantity 3 execution. No other executions are shown until I clicked the button to exit and stop trading. The Market Buy Order to exit also had a split fill with a Quantity 2 execution followed within the same second by another Quantity 2 execution. It is clear from the log records that 8 contracts were not sold, so why did NT show me Short 8 contracts?

    I am using NinjaTrader Version 8.0.24.3 with a NinjaTrader Continuum connection.

    #2
    Hello caveat_lector,

    Was this position shown as the strategy position on the Strategies tab of the Control Center?

    Or was this the account position shown on the Accounts tab of the Control Center?

    We would like to review the log and trace files to see the instrument updates. Please send an email to [email protected]. In the email please include a link to this forum thread.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The position was shown in the Current Position field of Chart Trader. The $4000 intraday margin amount was shown in the Accounts tab of the Control Center. I didn't take time to look anywhere else, because it seemed best to immediately go Flat and stop trading given that both the cause and true status were unknown.

      An email with the log and trace files attached has been sent.

      Comment


        #4
        Hello caveat_lector,

        Can you reproduce this behavior?

        Does the Positions tab of the Control Center show this position?

        Is the ChartTrader properties set to show realized pnl when flat? (fyi, chart trader would not be reflecting the strategy position. this could be reflecting either the account position or account realized. always the view strategies tab of the control center to get information about a strategy)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          We have been away and didn't want to run the Strategy on a real-money account again until we are able to watch it. It is set to run when the market opens this (Sunday) afternoon. I will let you know what happens.

          I didn't take time to look at the Control Center Positions tab, because it seemed clear that something was wrong and so best to flatten and then investigate. Now that I can see and you have confirmed that both the log and trace files show the strategy was only short 4 contracts, I won't be so concerned and will look at more things and capture a screen image or two if there is a repeat occurrence.

          Chart Trader properties were not set to show realized PnL when flat and the PnL display unit was set to Ticks. The Strategy plots the cumulative currency PnL in a panel below the Price Panel at the close of each price bar. It also displays that PnL amount numerically in a large font centered over the PnL plot with a one-minute update frequency. Normally the current Position based upon values passed by OnPositionUpdate() is also printed in the upper-right corner of that panel, although I was temporarily using that to display a variable value related to the trading logic at the time and so didn't have the benefit of that when the problem occurred. That current Position display has been restored and will be available if the problem reoccurs.

          Comment


            #6
            Again tonight when the Control Center Accounts tab is selected the Intraday margin field shows a $4000 margin requirement with a 4-contract RTY position. I suspect that happens, because the Strategy is Long for contracts with a 4-contract Stop Loss Order below the current price and another 4-contract Stop Entry Order further below that to enter Short if the price goes down that far. In other words, the first Stop Loss order, if hit, would make the position Flat. The second Stop Order further below that, if hit, would make the position Short 4. Even though there could never be an 8-Contract Position given the current position and those Stop orders NT reports there is an 8-Contract margin requirement.

            I have screen images that show what I have explained more clearly, but I am getting ready for another trip and will have to post them in a day or two when I get back.

            Comment


              #7
              Hello caveat_lector,

              Is this a live order or a sim order?

              If this is a live order, contact your broker to discuss margin.

              If this is a sim order, what Risk template is applied to the Sim101 account?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                I was gone yesterday, but the Strategy has been running live since Sunday afternoon and they were live orders. The problem seems to have been fixed since Sunday, so I won't clutter the forum with the images referred to above unless it reoccurs.

                However this image shows the Strategy PnL and Position display referred to above. I have found that useful and am just sharing the idea in case others would like to add something similar to their Strategies. Click image for larger version

Name:	PnL&Position.gif
Views:	122
Size:	93.5 KB
ID:	1172823

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Barry Milan, Yesterday, 10:35 PM
                4 responses
                15 views
                0 likes
                Last Post Barry Milan  
                Started by DanielSanMartin, Yesterday, 02:37 PM
                2 responses
                13 views
                0 likes
                Last Post DanielSanMartin  
                Started by DJ888, 04-16-2024, 06:09 PM
                4 responses
                12 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by terofs, Today, 04:18 PM
                0 responses
                11 views
                0 likes
                Last Post terofs
                by terofs
                 
                Started by nandhumca, Today, 03:41 PM
                0 responses
                8 views
                0 likes
                Last Post nandhumca  
                Working...
                X