public MoneyFlow(Bars bars, string description) public static MoneyFlow Series(Bars bars)
using System; using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators;namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // The example below duplicates the calculation of the MFI double today = 0; double yesterday = 0; DataSeries MFPositive = new DataSeries( Bars, "MFPositive" ); DataSeries MFNegative = new DataSeries( Bars, "MFNegative" ); DataSeries MyMFI = new DataSeries( Bars, "MyMFI" ); DataSeries myAveragePrice = (High+Low+Close)/3; for(int bar = 1; bar < Bars.Count; bar++) { today = myAveragePricebar; yesterday = myAveragePricebar-1; if( today > yesterday ) MFPositivebar = MoneyFlow.Series( Bars )bar; else if( today < yesterday ) MFNegativebar = MoneyFlow.Series( Bars )bar; } DataSeries MFPosSum = Sum.Series( MFPositive, 14 ); DataSeries MFNegSum = Sum.Series( MFNegative, 14 ); DataSeries MoneyRatio = MFPosSum/MFNegSum; for(int bar = 14; bar < Bars.Count; bar++) MyMFIbar = 100 - ( 100 / ( 1 + MoneyRatiobar ) ); ChartPane MFPane = CreatePane( 30, true, true ); ChartPane MFIPane = CreatePane( 30, true, true ); PlotSeries( MFPane, MyMFI, Color.Navy, WealthLab.LineStyle.Solid, 2 ); PlotSeries( MFIPane, MFI.Series( Bars, 14 ), Color.Brown, WealthLab.LineStyle.Solid, 2 ); } } }