I have been looking for existing code for a strategy that I want to try but I cannot find any. I have been trying to learn EasyLanguage myself but I can't figure out what to do for my situation. Please help me! How can I get a signal when the MACD fast line has a slope of zero??? (There's more to it than just this.....) Thanks!!
Checking for absolute zero is futile...you need to determine when it changes direction. Code: MyMACD = MACD(Close, FastLength, SlowLength); MyFastAvg = Average(Close, FastLength); If MyFastAvg[1]<MyFastAvg[0] Then Begin GoLong = 1; End; If MyFastAvg[1]>MyFastAvg[0] Then Begin GoShort = 1; End; Just a suggestion. More sophisticated approaches would possibly use the slope of a linear regression for the past "X" bars....and then signal when the slope changes.
you can look for local minima or maxima ,google for a "peaks" lib, or calc slope. in all cases your answer will be from the past
Yes that's what I really need is when it peaks and changes direction. Thank you for your help! I'll look into lin reg as well.
MACD is usually calculated with Exponential Moving Averages. The EasyLanguage formula shown in the previous posts uses a Simple Moving Average. The fix is to change the Average function to XAverage.