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 tomvault, Today, 09:46 PM
          5 responses
          16 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by RISKYBUSINEZZ, Today, 09:17 PM
          0 responses
          4 views
          0 likes
          Last Post RISKYBUSINEZZ  
          Started by ETFVoyageur, 05-26-2024, 05:02 PM
          4 responses
          24 views
          0 likes
          Last Post ETFVoyageur  
          Started by RISKYBUSINEZZ, Today, 09:09 PM
          0 responses
          4 views
          0 likes
          Last Post RISKYBUSINEZZ  
          Started by ETFVoyageur, 05-26-2024, 08:42 PM
          4 responses
          43 views
          0 likes
          Last Post ETFVoyageur  
          Working...
          X