Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with multitimeframe strategy

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

    Problem with multitimeframe strategy

    Hello,
    I developped a multitimeframe (1 and 60 min) strategy and I meet a problem.
    I write this in onBarUpdate:
    I store in a doubles variables the hour information
    if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
    return;
    if(BarsInProgress == 1)
    {
    ema10=EMA(Close,mov10Hour)[0];
    ema50=EMA(Close,mov50Hour)[0];
    midband=MyPchannelBand(20,1.6,3.2,4.8, 20).Midband[0];
    bandplus=0;
    bandmoins=MyPchannelBand(20,1.6,3.2,4.8, 20).BandMoins2[0];

    }
    After I wrote my enter condition (always in the onBarupdate of course:
    if(midband>ema10)
    {
    if(High[0]>ema10 && Open[0]<ema10 && ema10>bandmoins)
    {
    EnterLong(100000, "B1");
    long_b1=1;
    }
    At the begining the backtest work well, the system enter and exit well and some time it do a false trade like:
    It enter at 17:00 and exit at 16h00 and more if I look the graph the conditions are wrong.

    I d'on't understand the problem,
    Could you help me please?

    Thank's for your help.

    #2
    Hello neo-13,
    To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

    Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

    I look forward to assisting you further.

    *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank's a lot for your answer and your help,
      but I found my error.

      Thank's again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      669 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      378 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X