Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting strategy: Unmanaged Approach

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

  • bjunaid
    replied
    ***************Update

    I was able to figure out the error. It was related to Market Data. I had to put the method in the statement if(State = State.Realtime) in OnBarUpdate.

    Thanks,

    Leave a comment:


  • bjunaid
    replied
    Hi Paul,

    So I clicked the Tick Replay when using the Strategy Analyzer however I am getting a an error:

    2020-11-09 16:55:33:282|3|4|Strategy 'UVSTRLOW': Error on calling 'OnBarUpdate' method on bar 0: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello bjunaid,

    Thanks for your reply.

    Correct, OnMarketData does not function on the static historical data in the Strategy analyzer.

    You could enable/use Tick Replay however the OnMarketData() method states: "If used with TickReplay, please keep in mind Tick Replay ONLY replays the Last market data event, and only stores the best inside bid/ask price at the time of the last trade event." Reference: https://ninjatrader.com/support/help...marketdata.htm Note that you would need tick data for the entire duration of the backtest period.

    I would suggest using PlayBack with market replay data to backtest your strategy. This will be a significantly slower backtest process but will provide all of the data you need to run your strategy.

    Reference:https://ninjatrader.com/support/help...connection.htm

    Leave a comment:


  • bjunaid
    replied
    Hi,

    My entries are based OnMarketData function. Could it be because of this function since it relies on real time data?

    Leave a comment:


  • bjunaid
    replied
    Thanks, I will take look.

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello bjunaid,

    Thanks for your post.

    When something is not working as expected, please check the "Log" tab of the control center for any related error messages.

    If no error messages then please run the strategy SampleMACrossover in the strategy analyzer using the exact same start/end dates, bar type and size. If there are no results this would indicate that you do not have the data needed. You might try changing the start/end dates or create a chart of the instrument and observe if you have data for it.

    If the sampleMACrossover produces results and the results show trades from the beginning of your data to the end that the issue would be related to your strategy. Does your strategy have any check that it only will run on Real time data?

    If no checks for Real time data, then the next step would be to debug your strategy using print statements that sends their output to the New>Ninjascript output window. Typically you would print out the values of the conditions for placing the order(s) and this may lead you down the investigative path. Here is a link to our debugging tips: https://ninjatrader.com/support/help...script_cod.htm

    Note: That your strategy is working fine on real time data makes me suspect either the historical data or coding that specifies using Real time (or not using historical).

    Leave a comment:


  • bjunaid
    started a topic Backtesting strategy: Unmanaged Approach

    Backtesting strategy: Unmanaged Approach

    Hi,

    I have tried back testing my strategy but every time I try to run the back test, it comes back without any results. I am not sure what is causing this behavior? I am wondering if there are any errors in the strategy. Strategy seems to be working fine when I test it on simulation account.

    Thanks,

Latest Posts

Collapse

Topics Statistics Last Post
Started by salination2, Yesterday, 07:21 PM
1 response
6 views
0 likes
Last Post s.kinra
by s.kinra
 
Started by aarons34, Yesterday, 08:11 PM
0 responses
7 views
0 likes
Last Post aarons34  
Started by Shiner452, Yesterday, 06:55 PM
0 responses
3 views
0 likes
Last Post Shiner452  
Started by Aquatrade, Yesterday, 06:22 PM
0 responses
3 views
0 likes
Last Post Aquatrade  
Started by trader3000a, Yesterday, 02:04 PM
2 responses
26 views
0 likes
Last Post trader3000a  
Working...
X