Можно, там, правда, ничего необычного нет. Взгляните:
[CODE]
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using ZIndicators;
namespace WealthLab.Strategies
{
public class VolatilityDriven : WealthScript
{
StrategyParameter period;
StrategyParameter K;
public VolatilityDriven()
{
period = CreateParameter("Period", 36, 10, 100, 1);
K = CreateParameter("Volatility Gain", 2.5, 1, 4, 0.1);
}
protected override void Execute()
{
int per = period.ValueInt;
double gain = K.Value;
DataSeries MA = SMA.Series( Close, per );
DataSeries std = StdDev.Series( Close, per, WealthLab.Indicators.StdDevCalculation.Sample ) ;
DataSeries UpperBound = MA + gain * std;
DataSeries LowerBound = MA - gain * std;
PlotSeries(PricePane, MA, Color.Violet, WealthLab.LineStyle.Dashed, 2);
PlotSeries(PricePane, UpperBound, Color.Green, WealthLab.LineStyle.Dotted, 2);
PlotSeries(PricePane, (LowerBound, Color.Green, WealthLab.LineStyle.Dotted, 2);
for(int bar = per; bar < Bars.Count; bar++)
{
if (LastActivePosition != null)
{
if (LastPositionPosition.PositionType == PositionType.Short)
{
if (CrossUnder(bar, Close, UpperBound))
{
CoverAtMarket(bar + 1, LastPosition);
}
}
else
{
if (CrossOver(bar, Close, LowerBound))
{
SellAtMarket(bar + 1, LastPosition);
}
}
}
else
{
if (CrossUnder(bar, Close, UpperBound))
BuyAtMarket(bar + 1);
if (CrossOver(bar, Close, LowerBound))
ShortAtMarket(bar + 1);
}
}
}
}
}
[/CODE]