MoneyFlow won’t compile, wants 4 inputs


Category:
0
0

I was going to scan to make sure that there is positive moneyflow into a stock. I try and go def price = close; def MoneyTotal= MoneyFlow(price); The compiler complains no default value for “low” and no default value for “volume”. I tried MoneyFlow(price, low, volume); and it complained that no volume input. I then input MoneyFlow(price, low, volume, anything) and it compiles. TOS says we only need price. Are you aware of anything missing?

 

Marked as spam
Posted by (Questions: 4, Answers: 5)
Asked on November 17, 2017 6:24 pm
69 views
0
Private answer

Why not just use the entire source code instead of trying to reference the study?

input price = close;
plot MF = TotalSum(if price < price[1] then -price * volume else if price > price[1] then price * volume else 0);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on November 17, 2017 8:16 pm
0

Just being stubborn and want it to work as expected. This solution had been proposed to me, but was curious if you knew why the study didn’t work as expected. Thinking long term where I may want to compare to the zeroline in the MoneyFlow, but sometimes simple is best

( at November 18, 2017 10:59 am)
0

Ah, ok. Well I can explain that very simply. The indicator is not structured correctly to permit it being referenced from another study. I can show you what is needs to look like, from that you can understand why it doesn’t work “as expected”. I’ll post this in a new answer to this post.

( at November 18, 2017 12:13 pm)
0
Private answer

In response to the viewer’s request as to ‘why’ the MoneyFlowIndex cannot be referenced from within a scan. I submit the following screenshot. I took the source code and added the missing element. Which is an input for the volume, named “vol”. Once this is supplied as an input and used as a replacement for the volume, the study can then be referenced from within a scan. Notice when we reference the study within a scan we now must supply exactly two inputs, one for the price, and one for the volume.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on November 18, 2017 12:32 pm
0
Thanks for the detailed response. This solution helped my understanding in TOS. In particular, I was missing the idea we can write our own functions and function calls. I did read about the keyword script, but testing first on the chart and then calling the function in the scan just feels more intuitive.
( at November 19, 2017 10:16 am)
0

Awesome. Very glad to hear my response was able to open up some new doors for you. Love it.

( at November 19, 2017 11:23 am)