Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multi-timeframe strategy not working

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

    multi-timeframe strategy not working

    Hey all,

    I have a strategy working on a custom timeframe (NinzaRenko) in which I also add a second timeframe:

    AddDataSeries(BarsPeriodType.Minute, 5);
    Then, the first line of OnBarUpdate() is a check if we have enough bars to trade.

    if (CurrentBars[0] < BarsRequiredToTrade || CurrentBars[1] < BarsRequiredToTrade)
    return;
    Unfortunately, the code gets returned every call to OnBarUpdate(), so the strategy never runs the rest of the method and enters/exits trades.

    I need to increase the number of bars loaded in the additional data series. However, there doesn't seem to be a field in add data series that allows me to do so properly.

    #2
    Hello pappal,

    Thanks for your post.

    The added data series will load the bars based on the chart bars. If the chart bars are set to load 3 days of data then the added data series will load the appropriate number of 5 minute bars.

    If you need more bars, increase the number of days to load for the chart bars.

    Note: Typically the BarsRequiredToTrade defaults to 20 which means you would need 20 x 5minute = 100 minutes of data loaded. There may be something else in error unless you have a high number set for BarsRequired or have restricted your chart bars to a short number. You may want to add print statements to your code to verify what bars are being processed before the return statement.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by krpkevin, Today, 07:50 AM
    0 responses
    1 view
    0 likes
    Last Post krpkevin  
    Started by robforee2, Yesterday, 06:11 PM
    2 responses
    15 views
    1 like
    Last Post NinjaTrader_ChrisL  
    Started by minds2010, Today, 03:38 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by DTSSTS, Yesterday, 07:11 PM
    2 responses
    32 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by ntbone, Yesterday, 11:42 PM
    3 responses
    18 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Working...
    X