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.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    89 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X