Indicator example
Money Flow Indicator
Readonly source from tests/EasyLanguage/David_EasyLanguage, generated Pine Script v6, and an expiry-free example EX5.
Original EasyLanguage
{ Search Tag: WA-Money Flow }inputs:Length( 14 ) [DisplayName = "Length",ToolTip = "Enter number of bars over which to calculate Money Flow."],AlertLength( 14 ) [DisplayName = "AlertLength",ToolTip = "Enter number of bars over which to look for a bullish or bearish divergence."],OverSold( 20 ) [DisplayName = "OverSold",ToolTip = "Enter the level of the indicator at which you consider the market to be oversold (too low)."],OverBought( 80 ) [DisplayName = "OverBought",ToolTip = "Enter the level of the indicator at which you consider the market to be overbought (too high)."],OverSColor( MyColors( "DodgerBlue" ) ) [DisplayName = "OverSColor",ToolTip = "Oversold Color. Enter the color to use when the indicator's value is below OverSold."],OverBColor( Red ) [DisplayName = "OverBColor",ToolTip = "Overbought Color. Enter the color to use when the indicator's value is above OverBought."];variables:MoneyFlowValue( 0 );MoneyFlowValue = MoneyFlow( Length );Plot1( MoneyFlowValue, !( "MoneyFlow" ) );Plot2( OverBought, !( "OverBot" ) );Plot3( OverSold, !( "OverSld" ) );{ color criteria }if MoneyFlowValue > OverBought thenSetPlotColor( 1, OverBColor )else if MoneyFlowValue < OverSold thenSetPlotColor( 1, OverSColor );{ alert criteria }if AlertEnabled thenbeginif LowestBar( C, AlertLength ) = 0and LowestBar( MoneyFlowValue, AlertLength ) > 0 thenbeginAlert( !( "Bullish divergence - new low not confirmed" ) );endelse if HighestBar( C, AlertLength ) = 0and HighestBar( MoneyFlowValue, AlertLength ) > 0 thenbeginAlert( !( "Bearish divergence - new high not confirmed" ) );end;end;{ ** Copyright © TradeStation Technologies, Inc. All Rights Reserved **** TradeStation reserves the right to modify or overwrite this analysis techniquewith each release. ** }
Generated Pine Script v6
//@version=6indicator("MoneyFlowIndicator", overlay=true)length = input.float(14.0, "length")alertlength = input.float(14.0, "alertlength")oversold = input.float(20.0, "oversold")overbought = input.float(80.0, "overbought")overscolor = input.color(color.rgb(30, 144, 255), "overscolor")color overbcolor = color.redvar float moneyflowvalue = 0float __el_plot1 = nacolor __el_plot1_color = color.bluefloat __el_plot2 = nacolor __el_plot2_color = color.bluefloat __el_plot3 = nacolor __el_plot3_color = color.blue__el_call1 = ta.mfi(hlc3, int(length))__el_call2 = ta.lowestbars(close, int(alertlength))__el_call3 = ta.lowestbars(moneyflowvalue, int(alertlength))__el_call4 = ta.highestbars(close, int(alertlength))__el_call5 = ta.highestbars(moneyflowvalue, int(alertlength))if bar_index >= 13moneyflowvalue := __el_call1__el_plot1 := moneyflowvalue__el_plot2 := overbought__el_plot3 := oversoldif moneyflowvalue > overbought__el_plot1_color := overbcolorelseif moneyflowvalue < oversold__el_plot1_color := overscolorif trueif __el_call2 == 0 and __el_call3 > 0alert("Bullish divergence - new low not confirmed", alert.freq_once_per_bar)elseif __el_call4 == 0 and __el_call5 > 0alert("Bearish divergence - new high not confirmed", alert.freq_once_per_bar)plot(__el_plot1, title="MoneyFlow", color=__el_plot1_color)plot(__el_plot2, title="OverBot", color=__el_plot2_color)plot(__el_plot3, title="OverSld", color=__el_plot3_color)
Compiled MetaTrader 5 example
The EX5 uses the original script filename stem and has no PineAnywhere expiration guard.