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 ZenCortexAuCost, Today, 04:24 AM
          0 responses
          5 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by ZenCortexAuCost, Today, 04:22 AM
          0 responses
          2 views
          0 likes
          Last Post ZenCortexAuCost  
          Started by SantoshXX, Today, 03:09 AM
          0 responses
          15 views
          0 likes
          Last Post SantoshXX  
          Started by DanielTynera, Today, 01:14 AM
          0 responses
          3 views
          0 likes
          Last Post DanielTynera  
          Started by yertle, 04-18-2024, 08:38 AM
          9 responses
          42 views
          0 likes
          Last Post yertle
          by yertle
           
          Working...
          X