Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
New'ish to trading but need a little help and hopefully found the right place.
I have written a small VB program to signal trades, I capture data from CMC Markets (web scraping) and put this in a MySQL Database for realtime and historical analysis. I want to calculate the MACD to add divergamce into to my trade trigger but I am NO maths guru (yes yes yes, I should have paid more attention at school but back then PC's had just arrived and I spent far too long programming them!!) and hoped some nice person would explain what I need to do.
Ideally in a dumb person guide to formulas
A = number of database entries for 9 days
B = average of all A entries
C = Maximum of A entries
MACD = A/B*C ^3
(Only an example or format!! not an attepmt at MACD or anything else lol)
Also as I said I grab my data by scapping CMC Markets I am sure this is not the best way so any help on getting good data, price, place, integration would be a great help. but I do want to use VB6 with any datafeed.
Regards
Steve
Can you help answer these questions from other members on NexusFi?
However it does not help too much as I cannot see the actual formula and even if I did unless it was in a noddy format (for idiots) then I would not be able to read/understand it any way
One thing that might be easier to answer is what data is used to create the 26/12 and 9 day EMA equations, is it the open / close / or open and close prices or something else?
Also if anyone can help on the initial questions that would be fantastic (a=b/c etc). thanks
MACD is based on exponential moving averages of the close. The Metastock divergence formula can be readily adapted for a spreadsheet or VBA/VB.NET. References for the functions and the ema can be found at the same site.
A = exponential moving average (EMA) of the last 12 periods of the close
B = EMA of the last 26 periods of the close
C= (A minus B)
D = trigger line = EMA of C of the last 9 periods of the close
E = differential = C minus D
C,D and E are collectively known as the MACD and any of them can be used for divergence comparison against the price.
Thankd Dave, few more questions, is it just the close prices we are using? as I am looking at a 1min chart
so this correct given I am using a 1 min chart.
To create the 26 days EMA we use close price for last 12 mins
To create the 26 days EMA we use close price for last 26 mins
To create the 26 days EMA we use close price for last 9 mins
Yes, you use only the close. You can calculate the MACD based on any period. If you are calculating the MACD based on a 1min interval, then the 12 period EMA is based on the past 12 closes of the 1min interval and so forth.
You simply substitute the desired price interval in the brackets, be it weeks, days, 30mins or 1min.
A = exponential moving average (EMA) of the last 12 (1min closes)
B = EMA of the last 26 (1min closes)
C= A minus B
D = trigger line = EMA of the last 9 values of C
E = differential = C minus D
Loks like Davel has given me all I need to calculate the MACD now but it looks like I need closing prices as I only scrape "current price" from CMC Markets and I don't think the will work with MACD (not that I have tried it) as the values can be points away.
Anyone know where I can get min by min closing prices?