Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current position in a backtest

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

    Current position in a backtest

    Hello,

    How can I know the current position (number of opened buy or sell contracts) in a standard Ninja backtest script?

    Thank you in adavance.


    regards.

    #2
    You can view all of the executions from the backtest under the Executions tab.

    You may also find what you you are looking for under the Trades tab.
    JessicaNinjaTrader Customer Service

    Comment


      #3
      This should help: http://www.ninjatrader-support.com/H...Positions.html

      Comment


        #4
        Thank you but this does not seem to work

        Position.MarketPosition and all the other options such as Positions.Quantity don't seem to be useful for backtests. They are not updated when orders are executed. They only seem to work for real time trading.

        In a backtest: I have EnterLongStop and EnterShortStop Orders. I want to be able to know when they are filled (if they are). If not filled whin a certain amount of time, I want to cancel them. I'm not able to find a solution for backtest mode.

        Any suggestion?

        If you'd like to have a look to the code I've written, I'd be pleased to share it.

        Comment


          #5
          Not sure I follow...

          Position.MarketPosition is updated on a reported fill of any order in backtest and live.

          If you want to cancel orders, use the CancelOrder() after holding a reference to an IOrder object that is returned when calling an order method.
          RayNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by kevinenergy, 02-17-2023, 12:42 PM
          118 responses
          2,778 views
          1 like
          Last Post kevinenergy  
          Started by briansaul, Today, 05:31 AM
          0 responses
          9 views
          0 likes
          Last Post briansaul  
          Started by traderqz, Yesterday, 12:06 AM
          11 responses
          28 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by PaulMohn, Today, 03:49 AM
          0 responses
          9 views
          0 likes
          Last Post PaulMohn  
          Started by inanazsocial, Today, 01:15 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jason  
          Working...
          X