Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Nested moving averages?

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

    Nested moving averages?

    Greetings,

    I'm trying to convert the following line of code to NT, it's a bit confusing because it uses "nested" EMA's:

    SMI:= 100 * (Mov(Mov(C-(0.5 * (HHV(H,lp) + LLV(L,lp))),sm,E),dsmp,E) / (0.5 * Mov(Mov(HHV(H,lp) - LLV(L,lp),sm,E),dsmp,E)));

    Here's what I wrote, it compiles just fine but my question is whether the logic has been properly duplicated?

    FirstInside.Set(Close[0] - (0.5 * (MAX(High, Lp)[0] + MIN(Low, Lp)[0])));
    Inside1 = EMA(FirstInside, Sm)[0];
    FirstInside2.Set(Inside1);
    Inside12 = EMA(FirstInside2, Dsmp)[0];
    SecondInside.Set(MAX(High, Lp)[0] - MIN(Low, Lp)[0]);
    Inside2 = EMA(SecondInside, Sm)[0];
    SecondInside2.Set(Inside2);
    Inside22 = 0.5 * (EMA(SecondInside2, Dsmp)[0]);

    SMI_VALUE = 100 * (Inside12 / Inside22);

    Thanks in advance for any confirmation/comments..etc...

    #2
    Metastock code? I am not too familiar with metastock functions, but the code you have produced looks correct to me.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the response. Actually the code is VT Trader...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NoLoEffeCo, Today, 01:44 PM
      0 responses
      4 views
      0 likes
      Last Post NoLoEffeCo  
      Started by WeyldFalcon, Today, 11:54 AM
      4 responses
      12 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by WeyldFalcon, Today, 11:50 AM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by rexsole, Today, 12:19 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_BrendanC  
      Started by torch2k, Today, 12:07 PM
      2 responses
      9 views
      0 likes
      Last Post torch2k
      by torch2k
       
      Working...
      X