• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 rouillard, Today, 03:34 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Tyler  
    Started by mquinteroj, Today, 02:41 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by JPPoulin, Today, 01:32 PM
    4 responses
    15 views
    0 likes
    Last Post JPPoulin  
    Started by bltdavid, Today, 01:09 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by pstrusi, Today, 12:50 PM
    2 responses
    8 views
    0 likes
    Last Post pstrusi
    by pstrusi
     
    Working...
    X