Created
June 18, 2018 07:32
-
-
Save sherwind/51ee46588e04c71044f0f5ad6a36941a to your computer and use it in GitHub Desktop.
Money Flow Oscillator 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@version=3 | |
// | |
// A volume indicator that measures buying and selling pressure over a given lookback period. | |
// As described at http://traders.com/Documentation/FEEDbk_docs/2015/10/TradersTips.html | |
// | |
// See also: | |
// - Are price updates a good proxy for actual traded volume in FX? <https://www.fxstreet.com/education/are-price-updates-a-good-proxy-for-actual-traded-201104220000> | |
// - Using Tick Volume in Forex: A Clear NVO Based Example <http://mechanicalforex.com/2010/08/using-tick-volume-in-forex-clear.html> | |
// | |
// ----------------------------------------------------------------------------- | |
// Copyright 2018 sherwind | |
// | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// any later version. | |
// | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// GNU General Public License for more details. | |
// | |
// The GNU General Public License can be found here | |
// <http://www.gnu.org/licenses/>. | |
// | |
// ----------------------------------------------------------------------------- | |
// | |
study("Money Flow Oscillator 2", shorttitle="MFO2") | |
input_len = input(5, title="Length") | |
input_sym1 = input(title="Symbol1", type=symbol, defval="FX_IDC:EURUSD") | |
input_sym1_current = input(false, title="Use Current Symbol for Symbol1") | |
input_sym2 = input(title="Symbol2", type=symbol, defval="FX_IDC:USDCHF") | |
mfo(len) => | |
HL1 = high - low[1] | |
HL2 = high[1] - low | |
OSC = (HL1 - HL2) / (HL1 + HL2) | |
MLTP = high < low[1] ? -1 : high[1] < low ? 1 : OSC | |
MFO = sum(MLTP * volume, len) / sum(volume, len) | |
plot(input_sym1_current ? mfo(input_len) : security(input_sym1, period, mfo(input_len)), title="MFO1", color=lime, transp=0) | |
plot(security(input_sym2, period, mfo(input_len)), title="MFO2", color=maroon, transp=0) | |
hline(0, title="Zero") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment