MoneyFlow won’t compile, wants 4 inputs


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: 2, Answers: 2)
Asked on November 17, 2017 6:24 pm
8 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: 36, Answers: 738)
Answered on November 17, 2017 8:16 pm

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)

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: 36, Answers: 738)
Answered on November 18, 2017 12:32 pm
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)

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)