Tuesday, February 28, 2017

bar object

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()
{
ClearDebug();
PrintDebug("High " + Bars.High[Bars.Count - 1]);
PrintDebug("Low " + Bars.Low[Bars.Count - 1]);
PrintDebug("Open " + Bars.Open[Bars.Count - 1]);
PrintDebug("Close " + Bars.Close[Bars.Count - 1]);
//double range1 = Bars.High[Bars.Count - 1] - Bars.Low[Bars.Count - 1];
//PrintDebug("range " + range);

//double range1 = Bars.High[Bars.Count - 2] - Bars.Low[Bars.Count - 2];
//PrintDebug("range " + range);
const int period = 1;

double sum = 0d;
double r1 = 0d;

for(int bar = Bars.Count - 1; bar >= Bars.Count - period; bar--)    {
r1 = Bars.High[bar] - Bars.Low[bar];
PrintDebug("range " + r1);
sum = sum + Bars.Close[bar];

}
double avg = sum / period;
PrintDebug("The " + period + "-Period average is: " + avg);


}
}
}

Tuesday, February 21, 2017

1st concept of programming wealth lab

open a chart and define scale ex. 1 minute, then date rang. ex. 500 bars, then position size. ex. 100



1. scale
2. range
3. size
4. symbol
5. enable streaming (it will turn blue when enabled)
6. click on GO, it will run strategy according to scale (this chart is using one minute). Every one minute it will print out debug window