Traders' Tip text
The code for time-based Ermanometry system is available for instant download from Wealth-Lab's "Open Strategy" dialog.
Figure 1. A Wealth-Lab Developer 6.2 chart showing the Ermanometry/Coles bar chart markup applied to a Daily chart. The Erman bars are red and the Coles series are blue.
Users should be aware that with methods without a rock solid starting point, it's an open question whether does automating line placement on the chart removes the subjectivity. And one thing's for sure: If you draw enough lines on a chart, some of them are bound to hit important turning points.
WealthScript Code (C#)
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class Ermanometry : WealthScript
{
Font font = new Font("Wingdings", 8, FontStyle.Bold);
Font font2 = new Font("Verdana", 7, FontStyle.Regular);
string upArrow = Convert.ToChar(0x00E9).ToString();
string dnArrow = Convert.ToChar(0x00EA).ToString();
private StrategyParameter paramEF;
private StrategyParameter paramDE;
private StrategyParameter paramStartBar;
public Ermanometry()
{
paramEF = CreateParameter("seed segment EF", 10, 1, 900, 1);
paramDE = CreateParameter("seed segment DE", 10, 1, 900, 1);
paramStartBar = CreateParameter("Start bar", 1, 1, 1440, 1);
}
protected override void Execute()
{
int EF = paramEF.ValueInt;
int DE = paramDE.ValueInt;
int Ratio=EF/DE;
double Inverseratio = 1d/Ratio;
double CD=DE*Inverseratio;
double BC=CD*Inverseratio;
double AB=BC*Inverseratio;
double FG= EF*Ratio;
double GH=FG*Ratio;
double HI=GH*Ratio;
double IJ=HI*Ratio;
double FH= Math.Sqrt(Math.Pow(FG,2)+Math.Pow(GH,2));
int x = 0; // bars since
SetBarColors( Color.Silver,Color.Silver );
HideVolume();
int init = Math.Min(Bars.Count-1, paramStartBar.ValueInt);
for(int bar = init; bar < Bars.Count; bar++)
{
x = bar - init;
// Marking Ermanometry bars
bool cond01 = (x==Math.Round(FH)); //Erman
bool cond02 = (x==Math.Round(GH)); //Erman
bool cond03 = (x==Math.Round(HI)); //Erman
bool cond04 = (x==Math.Round(IJ)); //Erman
bool cond05 = (x==Math.Round(DE+EF+CD)); //Erman
bool cond06 = (x==Math.Round(GH+HI+IJ)); //Erman
bool cond07 = (x==Math.Round(CD+DE+EF+FG+GH+HI)); //Erman
bool cond08 = (x==Math.Round(EF+FG+GH)); //Erman
bool cond09 = (x==Math.Round(CD+DE+EF+FG+GH)); //Erman
bool cond10 = (x==Math.Round(CD+DE+EF+FG+GH+HI)); //Erman
bool cond11 = (x==Math.Round(GH+IJ+CD+AB+EF)); //Erman
if( cond01 || cond02 || cond03 || cond04 || cond05 ||
cond06 || cond07 || cond08 || cond09 || cond10 || cond11
) {
AnnotateBar(upArrow, bar, false, Color.Red, Color.Transparent, font);
AnnotateBar( "E", bar, false, Color.Red, Color.Transparent, font2);
SetBarColor( bar, Color.Red );
}
cond01 = (x==Math.Round(FH+FG+GH)); //Coles
cond02 = (x==Math.Round(AB+BC+CD+DE)); //Coles
cond03 = (x==Math.Round(AB+BC+CD+DE+GH)); //Coles
cond04 = (x==Math.Round(FG+GH)); //Coles
cond05 = (x==Math.Round(GH+HI)); //Coles
cond06 = (x==Math.Round(FG+BC+CD)); //Coles
cond07 = (x==Math.Round(FG+BC+CD+DE)); //Coles
cond08 = (x==Math.Round(CD+BC)); //Coles
cond09 = (x==Math.Round(DE+BC)); //Coles
cond10 = (x==Math.Round(Math.Sqrt(Math.Pow(CD,2)+Math.Pow(DE,2))+CD+DE)); //Coles
cond11 = (x==Math.Round(Math.Sqrt(Math.Pow(EF,2)+Math.Pow(FG,2))+EF+FG)); //Coles
// Marking Coles bars
if( cond01 || cond02 || cond03 || cond04 || cond05 ||
cond06 || cond07 || cond08 || cond09 || cond10 || cond11
) {
AnnotateBar(upArrow, bar, false, Color.Blue, Color.Transparent, font);
AnnotateBar( "C", bar, false, Color.Blue, Color.Transparent, font2);
SetBarColor( bar, Color.Blue );
}
}
}
}
}