MACD value crosses average below zero with close above 200 sma


Category:
0
0

Hi Pete!  I’m not sure this would require more than a few minutes of your time (it seems easy, but not for me!), so I’d be happy to contribute here on the site if so…I’m just trying to create a script for a MACD/SMA200 combination.  So first the price action needs to be above the 200SMA (if looking for long signals)…so I guess closing price…and the MACD needs to be below the zero line (for longs..obviously above for shorts) and also doing a crossover of the lines.  I got this code from the TOS forum, but it’s missing operators I guess:

MACD().”Value” crosses above MACD().”Avg” and MACD().”Diff” < 0

AND close > Average(close,200)

Any chance you could help out with this here?  -ryan

Attachments:
Marked as spam
Posted by (Questions: 5, Answers: 7)
Asked on May 6, 2020 6:13 pm
144 views
0
Private answer

This portion of your code is contradictory:

MACD().”Value” crosses above MACD().”Avg” and MACD().”Diff” < 0

In English, it says that the value line plot of the MACD is crossing above the average line of the MACD while the histogram of the MACD is below zero. When the value line crosses above the average line the histogram (Diff) is always above zero. So you need to remove that portion of your statement to get this to work:

MACD().”Value” crosses above MACD().”Avg” and close > Average(close, 200)

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 6, 2020 7:31 pm
0
Hi Pete! This is awesome...so it's almost there. I can't post a new picture, but now the script is signaling everytime the MACD has a crossover, which is great...but I only want it to signal if it has a crossover AND it's below the zero line. Can we add teh "DIFF" less than zero somewhere in there?
( at May 7, 2020 6:10 am)
0
Nevermind...i think i get it. You can't have both a crossover and the MACD be below the zero line. In TOS the lines visually can be below the zeroline, but in fact they are positive in the histogram and are just lagging. Got it.
( at May 7, 2020 7:55 am)
0
This was posted in the other question where you requested help: MACD()."Value" crosses above MACD()."Avg" and MACD()."Value" is less than 0 and close is greater than MovAvgExponential("length" = 200)."AvgExp"
( at May 8, 2020 8:43 am)