Scan for custom Vscore crossing zero line, w/code


Category:
0
0

Hi Peter, attached is the code for the Vscore.  I’ve never had to create a scan or custom study that signals from a non-thinkorswim included study, so I’m interested in learning more about this.  Again, i’m just trying to script the “Vscore” line crossing from below, up across the “mean” line.

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

Converting a chart study into a scan is pretty much the same process for nearly every chart study. The process consists of three steps:

  1. Change all "plot" statements to "def"
  2. Remove all the style statements for each of those "plot" you just changed to "def"
  3. Add the final line of code such as "plot scan = <<true/false>> ;" After the equal sign will be your true/false statement that generates the scan results

This has been described many times thorough this forum. (and more than a few of my free tutorial videos). The process can get a bit more complicated for the licensed studies and there are even some studies that can never be converted into a scan.

For your specific piece of code the final statement that gets added in step 3 is as follows:

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

I have attached a version of your code that has been converted to a scan as a plain text file attached below this answer. In that file you will find I also removed every line that was not required to run the scan.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 15, 2020 3:11 pm
0
This is amazing Pete. I THINK i could figure this out on my own for the next one/next time now. I'll take a look at those videos as well. Now, can I add the MACD script to that script as well? The MACD()."Value" crosses above 0 that I discussed earlier
( at October 15, 2020 4:05 pm)
0
or would I have to add it as something like this... declare lower; input fastLength = 12; input slowLength = 26; input MACDLength = 9; input averageType = AverageType.EXPONENTIAL; input showBreakoutSignals = no; def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength); def Avg = MovingAverage(averageType, Value, MACDLength); def Diff = Value - Avg; def ZeroLine = 0; def UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN; def DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN; plot scan = Value < 0
( at October 15, 2020 4:36 pm)
0
I see you posted a new question for that so I will not provide a solution in this post. The new question you posted is available here: https://www.hahn-tech.com/ans/macd-scripting-for-value-line-crossing-zero-line/
( at October 15, 2020 6:47 pm)