NexusFi: Find Your Edge


Home Menu

 





Moving averages


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one yiman with 5 posts (0 thanks)
    2. looks_two cunparis with 2 posts (0 thanks)
    3. looks_3 David with 2 posts (2 thanks)
    4. looks_4 petemm with 1 posts (0 thanks)
    1. trending_up 5,900 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 yiman 
London
 
Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker: IB, PFG Best
Trading: 6E, EMD, TF
Posts: 266 since Jul 2009
Thanks Given: 111
Thanks Received: 160

Does anyone know if there is anything anywhere that will measure the difference betwwen two moving averages . then give an indication when its above a value say >8 tics/pips or whatever


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
NinjaTrader Parent Payward Acquires Bitnomial for $550M …
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #2 (permalink)
 David 
UK
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Futures
Posts: 88 since Jun 2009
Thanks Given: 35
Thanks Received: 85

The standard MACD indicator measures the difference between two moving averages.

So MACD(12,26,9) shows the difference between the 12 MA and the 26 MA

The histogram that is often plotted as part of the MAC indicator represents the actual difference between the two averages, which is why when the averages cross, the difference is 0.

David


Reply With Quote
Thanked by:
  #3 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,095



David View Post
The standard MACD indicator measures the difference between two moving averages.

So MACD(12,26,9) shows the difference between the 12 MA and the 26 MA

The histogram that is often plotted as part of the MAC indicator represents the actual difference between the two averages, which is why when the averages cross, the difference is 0.

David

Just a slight correction, the MACD uses Exponential moving averages.

I use a difference between two MA's a lot in my custom indicators. I just write up my own and take the difference. In tradestation it looks like

 
Code
Value1 = Average(C, 3) - Average(C, 10);


Follow me on X Reply With Quote
  #4 (permalink)
 yiman 
London
 
Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker: IB, PFG Best
Trading: 6E, EMD, TF
Posts: 266 since Jul 2009
Thanks Given: 111
Thanks Received: 160

Thanks for the response,

I have 2 exponential MA , EMA 10 and 26 what im trying to do is get ninja trader to give me a warning when the seperation between the two reaches 8 on the most recent closed candle. This will be a trigger for a possible entry .


Started this thread Reply With Quote
  #5 (permalink)
 yiman 
London
 
Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker: IB, PFG Best
Trading: 6E, EMD, TF
Posts: 266 since Jul 2009
Thanks Given: 111
Thanks Received: 160

does this look ok
value= ExponentialAverage[10](close)-ExponentialAverage[26](close)
RETURN value

Its my first go at programing


Started this thread Reply With Quote
  #6 (permalink)
 David 
UK
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Futures
Posts: 88 since Jun 2009
Thanks Given: 35
Thanks Received: 85

No, it should be this:

double value = EMA(Close,10)[0] - EMA(Close,26)[0];

David


Reply With Quote
Thanked by:
  #7 (permalink)
 yiman 
London
 
Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker: IB, PFG Best
Trading: 6E, EMD, TF
Posts: 266 since Jul 2009
Thanks Given: 111
Thanks Received: 160

Thanks David


Started this thread Reply With Quote
  #8 (permalink)
 yiman 
London
 
Experience: Intermediate
Platform: ninjatrader, multicharts, MT4
Broker: IB, PFG Best
Trading: 6E, EMD, TF
Posts: 266 since Jul 2009
Thanks Given: 111
Thanks Received: 160

I havent got a clue how to use ninjascript and i keep getting errors when i tried to use the code


Started this thread Reply With Quote
  #9 (permalink)
 
cunparis's Avatar
 cunparis 
Paris, France
 
Experience: Advanced
Platform: Market Delta & Ninjatrader
Trading: ES
Posts: 2,565 since Jun 2009
Thanks Given: 1,162
Thanks Received: 2,095


yiman View Post
I havent got a clue how to use ninjascript and i keep getting errors when i tried to use the code

Not to be harsh but it's not possible for you to develop with Ninjatrader without knowing C# and their API (Ninjascript is just their API which is built with C#). There are a number of C# books to teach you the basics. If you want to do something really simple you can use the wizard. If you think C# is too complicated for you then you can take a look at EasyLanguage. EL is 1000x simpler than C#. I'm a professional software developer and I much prefer EL for the simple stuff (see my EL example posted above).

If you've never done any programming before you should count on several months to learn the basics of C#. It's not easy.

Finally, if programming is not your forté then I would also suggest the possibility that you don't program at all. Choose your indicators carefully (fewer is better, price & volume are 90% of what you need) and then do your backtesting by hand. I use an indicator on multiple timeframes and I couldn't test it in an automated strategy (limitation of how it was made with Tradestation). So I backtested it by hand. Took me weeks. But I learned a lot so it was well worth it and I now trade this strategy every day.

Many of the strategies I see in this forum are based on having multiple indicators and you enter a trade when the colors all line up. I'm still not convinced that this is possible but I'm trying them out to see if I can make them work but so far I'm not successful.


Follow me on X Reply With Quote
  #10 (permalink)
petemm
Prague, CZ
 
Posts: 10 since Dec 2009
Thanks Given: 1
Thanks Received: 2


Yes, learning NINJA API is difficult, my approach to any new language and API is take some examples and simply rewrite it. If is is indicator and I need new definition, I download other indicator, copypaste entire code, change name and change only one line with computation of the indicator.

To make it more simple, Try to download some complex indicator that uses more advanced techniques you need to use in your indicator (e.g. if you need to look values in history, simply look at indicator that uses these values - not to reinvent the wheel).


Reply With Quote




Last Updated on January 28, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts