Ejemplo n.º 1
0
        private void CompChart_OnChartRefresh(object sender, ChartComponentRefreshArguments arg)
        {
            if (this.strategyData == null || this.strategyData.Strategy == null)
            {
                return;
            }
            IStrategy strategy = this.strategyData.Strategy;
            //if (!arg.DataRefreshed)
            //    return;
            StrategyReferedPeriods referedPeriods = strategy.GetReferedPeriods();

            //当K线图上数据变化,需要修改策略画的图形
            //如果画的是K线,且K线周期发生了变化,那么适应全周期的策略需要重新计算
            if (!arg.PrevCompData.KlinePeriod.Equals(arg.CurrentCompData.KlinePeriod) && referedPeriods == null)
            {
                //重置当前策略
                this.strategyData.RefreshStrategy();
                strategy = strategyData.Strategy;
                strategy.Parameters.SetParameterValue(strategy.Parameters.GetParameterValues());
                Run();
            }
            else
            {
                Refresh();
            }
        }
Ejemplo n.º 2
0
 private void ChartComponent_OnChartRefresh(object sender, comp.ChartComponentRefreshArguments arg)
 {
     SetLbTime(arg.CurrentCompData.Time);
 }