示例#1
0
            protected override State <Config> Run(TradingProvider trading, DataProvider data)
            {
                decimal allocation = trading.GetPortfolio().GetAllocation(
                    AlgorithmConfiguration.BaseCurrency).Free
                                     *
                                     0.5M
                                     /
                                     data.GetCurrentPriceLastTrade(FirstPair);

                // If the Filter and CrossoverSMA signal the trade, we buy at market.
                trading.ExecuteMarketOrderBuy(FirstPair, allocation);
                if (_stoploss != null)
                {
                    return(new CancelStopState(_stoploss, _pyramid));
                }
                else
                {
                    return(new SetStopState(_pyramid));
                }
            }