by aladdin007 » Wed May 13, 2020 6:54 am
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using TASCIndicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
int period = 60;
double d = 2;
DataSeries relVol = Close*0; relVol.Description = "Relative Volume";
DataSeries theFoM = Volume*0; theFoM.Description = "Freedom of Movement";
for(int bar = 0; bar < Bars.Count; bar++)
{
relVol[bar] = RelVol.Series(Bars,period)[bar] > 0 ? RelVol.Series(Bars,period)[bar] : 0;
theFoM[bar] = FOM.Series(Bars,period)[bar] > 0 ? FOM.Series(Bars,period)[bar] : 0;
}
HideVolume();
ChartPane r = CreatePane( 30,false,true );
PlotSeries( r, relVol, Color.Black, LineStyle.Histogram, 3 );
ChartPane f = CreatePane( 30,false,true );
PlotSeries( f, theFoM, Color.Black, LineStyle.Histogram, 3 );
for(int bar = 1; bar < Bars.Count; bar++)
{
if (relVol[bar] <= d)
SetSeriesBarColor( bar, relVol, Color.DarkGray);
if (theFoM[bar] < d)
SetSeriesBarColor( bar, theFoM, Color.DarkGray);
if (theFoM[bar] > d || relVol[bar] > d) // Draw DPLs
{
DrawLine(PricePane,bar,Close[bar],Bars.Count-1,Close[bar],Color.Blue,LineStyle.Solid,1);
}