Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

using multiple timeframes and keltner channel

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

    using multiple timeframes and keltner channel

    Hi

    Im runnning a simple test strategy - going long whenever Close cross above a Keltner lower line.
    But i wish to use multipple timeframes to check other stuff before i enter - so i added one 60 minute DataSeries like this:
    Code:
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Minute, 60);
    }
    Im running this strategy on a 2000 tick chart or testing it on a 2000 tick Strategy Analyzer.
    But i have dificulties understanding the "main" Data series.
    If i only have the above line in my script - does that mean that i have 1 or 2 different data series?

    I run some EnterLong code - inside the
    if (BarsInProgress == 0) sentence. And as far as i can understand this is reffering to the chart or the analyzer "main" data series time frame? in my case the 2000 tick?

    The big issue that i have is that i get less trades if i just add the above mentioned time series with 60 minutes also if i do nothing inside any if (BarsInProgress == 1) sentence...


    So wihtout the 60 minutes added - i get 1265 trades. With the 60 minutes added i get 1237 trades.
    But all my enter/exit rules happens inside the BarsInProgress == 0 - so how can adding another time frame - change the number of trades - unless i actually do anything inside the BarsInProgress == 1 ?


    I also use the below lines of code.

    Code:
    f (BarsInProgress > 1)
    return;
    
    if (CurrentBars[0] <= BarsRequiredToTrade || CurrentBars[1] <= BarsRequiredToTrade)
    return;

    #2
    Hello KarstenKafl,

    Thank you for your post.

    By adding a data series using AddDataSeries, your strategy will contain 2 different series; the 2000-tick primary series, BarsInProgress[0], and the added 60-minute series, BarsInProgress[1].

    There are a number of factors that can contribute to seeing different trade results when adding the secondary data series.

    If you are referencing indicators based on the secondary data series, that may cause differences. Also, checking CurrentBars[1] <= BarsRequiredToTrade is a specific requirement for the added series and may also cause differences to be seen.

    Debugging:

    Ultimately, debugging steps should be taken to monitor the strategy as it is executing to determine why an action has been taken or has not been taken.

    In order to better understand how the code is working, I recommend adding some debugging prints to your strategy. By adding debugging prints for the values used to evaluate your conditions, outside of those conditions you can observe if the strategy's logic is allowing your order submission methods to fire.

    If you are seeing your order submission being reached, but it is not executing, there may be an issue where the strategy is hitting an internal rule that is not allowing you to re-enter. TraceOrders can be used in the strategy (set in State.SetDefaults or in the Strategy Builder under Default Properties) so it prints its order feedback, and you may also observe the log tab of the Control Center for additional information.

    Some items to check when you are taking debugging steps:
    1. Are your strategy's conditions allowing your order submission methods to be reached?
    2. Is the strategy currently in a position that is preventing it from submitting another entry order?
    3. Do you see any errors in the log tab of the Control Center or do Trace Orders give you any feedback?
    Please note if the strategy was developed by somebody other than yourself, the strategy developer should be consulted to confirm if that behavior is expected for their strategy.
    I've included some tips for debugging below. The Playback Connection can be used to replay data as if it were realtime.

    Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm

    TraceOrders - https://ninjatrader.com/support/help...aceorders2.htm

    Debugging in the Strategy Builder - https://drive.google.com/file/d/1mTq...w?usp=drivesdk

    Debugging Demo - https://drive.google.com/file/d/1rOz...w?usp=drivesdk

    Please let us know if we may further assist.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    20 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    119 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    63 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    45 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X