Избранное трейдера Miguel
using System.Collections.Generic; using System.Text; using System.Drawing; using WealthLab; using WealthLab.Indicators; namespace WealthLab.Strategies { public class MyStrategy : WealthScript { private StrategyParameter smaPeriod; public MyStrategy() { smaPeriod = CreateParameter("Range Sma Period", 1, 1, 50, 1); } protected override void Execute() { DataSeries range = High - Low; DataSeries rangeSma = new WealthLab.Indicators.SMA(range, smaPeriod.ValueInt, "sma"); DataSeries signal = rangeSma - new WealthLab.Indicators.Median(range, 200, "median"); for(int bar = 0; bar < Bars.Count; bar++) { if (IsLastPositionActive) { //code your exit rules here if (signal[bar] > 0) SellAtMarket(bar + 1, LastPosition, "sell"); } else { //code your entry rules here if (signal[bar] < 0) BuyAtMarket(bar + 1, "buy"); } } } } }