Convert custom DPO (FW_DPO_MOBO) into stock scanner


Category:
0
0

Mobius from ThinkorSwim wrote a custom script for FW_DPO_MOBO and I am trying to convert the AddCloud function into a Def variable. I want to run a scan when the DPO is in the green cloud. I can not convert the AddCloud function into a variable because I do not understand the else nan.

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on August 16, 2024 1:09 pm
26 views
0
Private answer

I have restated your original question which was:

"How to convert an AddCloud into a Def variable"

Because what you are truly asking for is to have a custom chart study converted into a scan. And the "AddCloud" statement is not the target. The elements used to create that green shading is further upstream. So the first thing we do is remove everything below the following line:

plot lower = mean + (-SDmult * SD);

And because you are seeking a scan for the solution, I moved your question out of the "Chart Studies" topic and into the "Stock Scanners" topic. The new title of your question describes the entire context of your request. This will help the rest of our viewers to quickly locate this solution using the search function.

So the solution to convert this into a scan is to realize the green shading is applied only when the DPO line is above the lower line of the standard deviation bands. So the scan signal is merely checking if DPO > lower. Here is the complete solution for the scan:

input price = close;
input dpoLength = 14;
input moboLength = 10;
input sdMultiplier = .8;
def sd = StDev(price, moboLength);
def dpo = price - Average(price[dpoLength / 2 + 1], dpoLength);
def mean = Average(dpo, moboLength);
def lower = mean + (-sdMultiplier * sd);
plot scan = dpo > lower;

Notice how much of that original code has been completely discarded. This is the bear minimum required to complete the scan using the source code you provided.

Marked as spam
Posted by (Questions: 37, Answers: 4108)
Answered on August 16, 2024 1:23 pm