Syntax
public Midas(Bars ds, int startBar, string description)
public static Midas Series(Bars ds, int startBar)
Parameter Description
ds |
The symbol's Bars object |
startBar |
The bar number at which Midas should start; generally a peak or trough. |
Description
The Midas indicators from the September 2008 issue of
Stocks & Commodities magazine. Midas is the cumulative Price * Volume (PV) minus the cumulative PV from the
startBar divided by the cumulative Volume minus the cumulative Volume from the
startBar. The articles author, Andrew Coles, PhD., claims that "the MIDAS algorithm locates the real underlying order of markets — the fractally ordered hierarchical levels of support and resistance — at the volume-weighted average price taken over an interval subsequent to a reversal in trend."
Example
// WealthScript from Sept 2008 Traders' Tip
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
public class MidasTouch : WealthScript
{
protected override void Execute()
{
const int c = 6;
const double pct = 7d;
Color[] color = new Color[c];
color[0] = Color.Blue;
color[1] = Color.Red;
color[2] = Color.BlueViolet;
color[3] = Color.Fuchsia;
color[4] = Color.Green;
DataSeries ap = AveragePrice.Series(Bars);
DataSeries pbSer = PeakBar.Series(ap, pct, PeakTroughMode.Percent);
DataSeries tbSer = TroughBar.Series(ap, pct, PeakTroughMode.Percent);
int bar = Bars.Count - 1;
int n = 0;
while (bar > 1 && n < c)
{
int pb = (int)pbSer[bar];
int tb = (int)tbSer[bar];
bar = Math.Max( pb, tb );
DataSeries midas = Midas.Series(Bars, bar);
PlotSeries(PricePane, midas, color[n], LineStyle.Solid, 2);
n += 1;
bar -= 1;
}
}
}
}