Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD in MultiTime Strategy

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

    MACD in MultiTime Strategy

    Hi, I'm using NT 6.5.
    I'm having problems with the MACD indicator in a multi-time strategy.
    Code:
     protected override void Initialize()
            {
                ClearOutputWindow();
                Add(PeriodType.Week,1);
                Add(PeriodType.Day,1);
                CalculateOnBarClose = true;
            }
    The problem is when i use the values of the MACD in the strategy, the calculated values are different from the ones that i can see on a simple charts. For example, I use:
    MACD(BarsArray[1],MACDCorto, MACDLargo, MACDSmooth).Diff[0]

    In the strategy, i get a value of 1,5454, but in a common chart, the value of the weekly MACD.Diff for the same instrument is 3,8.

    Please, any ideas of what is wrong will be very apprecieted.
    Regards,
    Federico

    #2
    Welcome to our forums - how do you start the strategy up, from the chart as well? If you would start it from the strategies tab for example the used historical data (Chart defaults Tools > Options > Data) might be different than what you load directly as you create the chart, thus the values could be different.

    Please also ensure to compare the same CalculateOnBarClose settings to eachother (strategy vs chart).

    Comment


      #3
      Thanks for the quick answer.
      I'm comparing the results of executing a Backtest from Strategy Analyzer against a chart created with End of Day Data from Yahoo.
      I try to check how is the CalculateOnBarClose property configured for the chart, but i couldn't find it. But, i understand that it is not a diference using historical data in both case.
      Do you have any other idea in order to detect the difference?

      Regards,
      Federico

      Comment


        #4
        Hello fscheu,

        When using NinjaTrader 6.5, the secondary series must be smaller than the primary. Since 1 week is your secondary series, you must then use a larger time frame series, such as 2 week for the primary series.

        Version 7 does not have this limitation. In my initial tests I was able to get these values to align as long as the same number of days were loaded for each.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Really? What kind of problem you mean?
          I have used multi time frame strategy with secondary series larger than primary series. I have not seen any problem in my live trading. I am using NT6.5.

          Comment


            #6
            Originally posted by millridge View Post
            Really? What kind of problem you mean?
            I have used multi time frame strategy with secondary series larger than primary series. I have not seen any problem in my live trading. I am using NT6.5.
            In realtime / market replay you should be fine using this layering.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, Yesterday, 01:02 PM
            0 responses
            27 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            18 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            160 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            95 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            148 views
            2 likes
            Last Post CaptainJack  
            Working...
            X