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

Backtest malfunctioning when too many trades

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

    Backtest malfunctioning when too many trades

    It seems to me that whenever my strategy trades in high number of times per day, the backtest doesn't give me correct results. When trading in low number of times, it's normal.

    It should be one buy then one sell, whether it's profit taker or stop loss. But in backtest, it keeps on buying and then in the next interval, it sells everything it has bought at the same time at the respective profit taker or the stop loss prices. As a result, I can't tell whether the script is working properly.
    If it is tested in real time data, it functions just fine. One buy, then one sell whenever the profit taker or stop loss triggers.

    Also, historical data sometimes miss a couple intervals of data. Not too critical, but kind of annoying.

    And is there a way to look at a different time intervals in the performance chart?. For instance, I'm trading using the 5 min chart, and in the performance chart I want to look at the say 1 second chart, so that I can see exactly where it transacted.

    #2
    Hello emoryhu,

    Thank you for writing in. Any logic that you have in the OnMarketData method will not trigger when backtesting. I would need to see your code to give you a more specific answer as to exactly what is happening. If you would like to send in your code, please feel free to email platformsupport[AT]ninjatrader[DOT]com with the subject line "ATTN: Michael M http://www.ninjatrader.com/support/forum/showthread.php?t=78524" and be sure to attach your code to the email.

    Unfortunately you cannot change the chart period shown in a backtest after you have run the backtest. You can however zoom in and zoom out. You can always print the specific variables you need to have the exact values for in your strategy and then view them from an Output window. They will print to the output window when a backtest is run.

    Please let me know if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    4 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    40 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    18 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X