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

Cumulitive Profit not changing..

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

    #31
    For testing strategies in real time the simulated connection works great. It doesn't resemble live market data but lets you control and manipulate the markets: http://www.ninjatrader.com/support/h...connection.htm

    If you're testing on the weekend (or when your instrument would be closed) be sure to change the session template to something that would be open (such as default 24/7)
    LanceNinjaTrader Customer Service

    Comment


      #32
      Lance, I figured why the #'s were off. The output for example would read -.72 and the strategy analyzer window would read -146. I guess you have to multiply by the # of shares(in my case 200 shares). Then the the last digit being 2 less I guess is just commission.

      Still having the issue with the orders not closing out at end of day when backtesting, it's something to do with this line...

      // If our Long Limit order is still active we will need to cancel it.
      {
      CancelOrder(entryOrder);
      }

      What exactly does this mean, it says "if order is still active", does this mean that it's still flat but it's been activated and the fill order is pending?

      if so do I need to put some sort of IF condiition before it such as...

      if (order.OrderState == OrderState.PendingSubmit)

      or

      if (entryOrder != null)
      Last edited by zachj; 11-03-2013, 06:01 PM.

      Comment


        #33
        If you want the orders to close out at the end of the session you can set ExitOnClose = true; http://www.ninjatrader.com/support/h...xitonclose.htm

        If you want it to be a custom exit time you would want to create your own exit/flatten routine.

        Example pseudo code:

        Code:
        if(its the exit time)
        {
          if(myIOrder != null)
            CancelOrder(myIOrder); //will also want to set the order to null (typically this is done in OnOrderUpdate() )
        
        }
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        22 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X