хочу сжать 1-минутные свечи в 15-минутки.
не пойму, что ему надо дать в качестве 1-го параметра:
sec.CompressTo( 15, (int) shift );
что-то связано с "Interval", а что как именно написать ?
********************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using TSLab.Script;
using TSLab.Script.Handlers;
using TSLab.Script.Helpers;
using TSLab.Script.Optimization;
using TSLab.Script.Realtime;
namespace TSLab.Samples
{
public class zzz_20121030_Compress : IExternalScript
{
public void Execute(IContext ctx, ISecurity sec)
{
// вычислим сдвиг от начала стандартной 15-минутки
int New_TF = 15;
double shift = 0;
for (int sc = sec.Bars.Count-1; (0<sc); sc--)
{
var ost_del = Math.IEEERemainder((double)sec.Bars[sc].Date.Minute, (double)New_TF);
if (ost_del==0)
{
shift = (sec.Bars.Count-1) - sc;
break;
}
}
// сжимаем минутки в 15-мин. со сдвигом
ISecurity sec_TF = sec.CompressTo( 15, (int) shift );
// покажем данные последней свечи после сжатия
int last_bar = sec_TF.Bars.Count;
ctx.Log("Time="+sec_TF.Bars[last_bar].Date , 0);
ctx.Log("Open="+sec_TF.OpenPrices[last_bar] , 0);
ctx.Log("High="+sec_TF.HighPrices[last_bar] , 0);
ctx.Log("Low="+sec_TF.LowPrices[last_bar] , 0);
ctx.Log("Close="+sec_TF.ClosePrices[last_bar] , 0);
} // Execute
} // конец скрипта
} // TSLab.Samples
********************************************************