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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X