Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Introducing Daily filter (Multitimeframe) to an existing strategy

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

    Introducing Daily filter (Multitimeframe) to an existing strategy

    Hi

    I developed a strategy (intraday bars), and I simply need to add a filter based on the SMA(ATR) on a DAILY basis.
    I thought it was easy
    In Initialize() I added:

    Add(PeriodType.Day, 1);
    ATRDaily = new DataSeries(this);
    SMAATRDaily = new DataSeries(this);

    In OnBarUpdate():
    ATRDaily.Set(ATR(BarsArray[1], 14)[0]);
    SMAATRDaily.Set(SMA(ATRDaily, 200)[0]);

    Then, in my trading conditions:
    if(my conditions
    && ATRDaily[0] > SMAATRDaily[0])
    EnterLong

    The system doesn't trade at all! Without my DailyATR condition it traded daily, and I can see many occasions when also my last condition was verified.
    I guess something is wrong in the code, but what?

    Thank you

    Stefy

    #2
    Try printing out values for your ATRDaily and your SMAATRDaily. Might as well add a print inside your if-statement too. If the print inside your if-statement never prints then your condition is never evaluating to true. That would be a show stopper. See if that is the case.

    If it is not the case then try using TraceOrders = true to see what the deal is with the orders and why they are either being ignored/cancelled/etc.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      The issue is apparently much simpler - I'm using Gain as data provider, which doesn't offer daily data.
      If I switch to equivalent minute data, it works fine.

      Comment


        #4
        Great. Glad you got it resolved.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        58 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X