Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

MACD 1Min and 3Min

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

    MACD 1Min and 3Min

    Hello

    I want to compare the MACD from the 1 min chart with the MACD of the 3 min chart
    I am having difficulties figuring this out.

    I cannot compare the MACD[0] with MACD[3} because they are not the same computations

    Can you give me some code to show me how to set up multiple time frames for the MACD

    Thanks in advance

    #2
    Hello bandit,

    Yes, there are a couple sample codes that you may view that will demonstrate how you may accomplish this. The first one that you may view is in our Help Guide at the link below, this goes over the how the multi-time frame script is going to be processed.



    NinjaTrader also comes preloaded with a sample strategy that you may view by going to Tools -> Edit NinjaScript -> Strategies -> SampleMultiTimeFrame. You may open the source code and run the Strategy to see how it is going to look in a live environment.

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Originally posted by bandit View Post
      Hello

      I want to compare the MACD from the 1 min chart with the MACD of the 3 min chart
      I am having difficulties figuring this out.

      I cannot compare the MACD[0] with MACD[3} because they are not the same computations

      Can you give me some code to show me how to set up multiple time frames for the MACD

      Thanks in advance
      There are three options:

      (1) loading secondary bar series and calculating indicator values from secondary bars
      (2) calculating composite bars from primary bars and calculating indicator values from composite bars
      (3) tweaking the indicator

      For your problem, it is easiest to tweak the MACD. The MACD uses three exponential moving averages. For the exponential moving average, Wilder Welles originally used a smoothing constant of 1/N, where N is the indicator period. Jack Hutson then suggested a smoothing constant of 2/(N+1), which is the prevailing method used for an EMA today. This enhanced definition allows you to approximate an EMA from a 3 minute bar series on a 1 minute chart.

      EMA (14) from 3 minute bars (approx.) = EMA(3*14) from 1 minute bars
      SMA( 14) from 3 minute bars (approx.) = SMA(3*14) from 1 minute bars

      Therefore you are allowed to to calculate your MACD(12,26,10) from 3-minute bars by setting up a MACD(36, 78, 30) on a 1-minute chart.

      But attention, with most indicators this does NOT work, SMA and EMA are an exception.

      The chart below shows a multiple MACD (timeframes 1, 3, 5, 10 minutes) overlaid on the price chart.

      1-minute MACD -> cornflower blue
      3-minute MACD -> white
      5-minute MACD -> dark orange
      10-minute MACD -> medium violet red
      Attached Files
      Last edited by Harry; 08-29-2013, 01:46 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Kaledus, Today, 01:29 PM
      0 responses
      3 views
      0 likes
      Last Post Kaledus
      by Kaledus
       
      Started by PaulMohn, Today, 12:36 PM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by yertle, Yesterday, 08:38 AM
      8 responses
      37 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by rdtdale, Today, 01:02 PM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by alifarahani, Today, 09:40 AM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X