MACD scripting for value line crossing zero line


Category:
0
0

Hi Pete,

Decided just to start this as a new topic so that I could attached the file correctly for you….going off of the lesson from your Vscore code when creating a scan from a custom study, would the attached be the long way (as opposed to just using the condition wizard) of creating a scan for the MACD value line crossing up to through the zero line?

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

Not exactly, no. The signal you created is for any stock in which the plot named Value from the MACD study is below zero. This is not the same as a crossing event, which occurs on a single bar. The scan signal you have there is for every bar where the Value plot is less than zero:

plot scan = Value < 0

Oh, and you forgot the included the ";" at the end of that statement so it will result in an error if you try to use that. But there is a chance that the code you saved to the plain text file was not complete. At any rate, we need to set the record straight for the rest of our viewers who will run across this post.

If you want the crossing event (Value line crossing above zero) then you would replace that last line with the following:

plot scan = Value[1] < 0 and Value > 0;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 15, 2020 6:44 pm
0
Right...got it. So it's the same as the Vscore code. Makes perfect sense.
( at October 15, 2020 7:50 pm)