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

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 sidlercom80, 10-28-2023, 08:49 AM
    166 responses
    2,233 views
    0 likes
    Last Post sidlercom80  
    Started by thread, Yesterday, 11:58 PM
    0 responses
    1 view
    0 likes
    Last Post thread
    by thread
     
    Started by jclose, Yesterday, 09:37 PM
    0 responses
    6 views
    0 likes
    Last Post jclose
    by jclose
     
    Started by WeyldFalcon, 08-07-2020, 06:13 AM
    10 responses
    1,414 views
    0 likes
    Last Post Traderontheroad  
    Started by firefoxforum12, Yesterday, 08:53 PM
    0 responses
    11 views
    0 likes
    Last Post firefoxforum12  
    Working...
    X