Проблема преобразования TimeSpan - AlfaTimeFrames

Проблема преобразования TimeSpan - AlfaTimeFrames
Atom
4/11/2013
zhuravl


Программный код:

public void Test() { CandleManager candleManager = new CandleManager(trader);

        // 5 minute candles
        CandleSeries series = new CandleSeries(typeof(TimeFrameCandle), security, TimeSpan.FromMinutes(5));
        series.ProcessCandle += series_ProcessCandle;
        candleManager.Processing += candleManager_Processing;

        candleManager.Start(series);
    }

    void series_ProcessCandle(Candle obj)
    {
        Logger.WriteLine("Process candle");
    }

    void candleManager_Processing(CandleSeries arg1, Candle arg2)
    {
        Logger.WriteLine("Received Processing event");
    }

Код ошибки:

Unhandled Exception: System.InvalidCastException: Unable to cast object of type 'System.TimeSpan' to type 'StockSharp.AlfaDirect.AlfaTimeFrames'. at StockSharp.AlfaDirect.AlfaTrader.#=qjbXuGHh73XvrWZicy6gOKXr2Dom0efIFR9MSjpJMLe0=(SynchronizedDictionary2 #=qA5mbLCf6AEYY2ZjSKZfmqw==) at Ecng.Collections.CollectionHelper.SyncDo[TCollection](TCollection collection, Action1 action) at StockSharp.AlfaDirect.AlfaTrader.#=qC5NNrqRcgxVSSeVdRzYPn46I7MwkMp1XS5d1hUpptZw=() at Ecng.Common.ThreadingHelper.<>c__DisplayClass1.b__0(Object s) at System.Threading.TimerQueueTimer.CallCallbackInContext(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserv eSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx ) at System.Threading.TimerQueueTimer.CallCallback() at System.Threading.TimerQueueTimer.Fire() at System.Threading.TimerQueue.FireNextTimers() at System.Threading.TimerQueue.AppDomainTimerCallback()


Tags:


Thanks:


esper

Avatar
Date: 4/11/2013
Reply


Чтобы указать таймфрейм для альфы, необходимо использовать AlfaTimeFrames.

Thanks:

zhuravl

Avatar
Date: 4/11/2013
Reply


В этом случае выдается

Unhandled Exception: System.ArgumentException: Параметр свечки 00:05:00 не правильный.

Thanks:

zhuravl

Avatar
Date: 4/11/2013
Reply


к удивлению код:

TimeSpan span = TimeSpan.FromMinutes(5); StockSharp.AlfaDirect.AlfaTimeFrames frame = (AlfaTimeFrames)span; TimeSpan span2 = (TimeSpan)frame;

Console.WriteLine(span); Console.WriteLine(frame); Console.WriteLine(span2); работает нормально

Thanks:

esper

Avatar
Date: 4/11/2013
Reply


Напишите мне в скайп, который в профиле.

Thanks:


Attach files by dragging & dropping, , or pasting from the clipboard.

loading
clippy