### XitThreeMaCrossStrategy Implementation in C# Source: https://github.com/stocksharp/algotrading/blob/main/API/2966_Xit_Three_Ma_Cross/README.md C# implementation of the XitThreeMaCrossStrategy utilizing the high-level StockSharp API. This strategy incorporates ATR subscriptions and risk sizing logic. It serves as a practical example of algorithmic trading strategy development within the StockSharp ecosystem. ```csharp using StockSharp.Algo; using StockSharp.Algo.Strategies; using StockSharp.Algo.Indicators; using StockSharp.Localization; public class XitThreeMaCrossStrategy : Strategy { private ThreeMovingAverages _maCross; private ATR _atr; public override void OnStarted() { // Initialize indicators _maCross = new ThreeMovingAverages { Period1 = 10, Period2 = 20, Period3 = 50, FastPeriod = 5, SlowPeriod = 15, Source = Security.ClosePrice }; _atr = new ATR { Period = 14, Source = Security.ClosePrice }; // Subscribe to data Subscribe(Security, _maCross); Subscribe(Security, _atr); base.OnStarted(); } protected override void OnProcessIndicator(IIndicator indicator) { if (indicator == _maCross) { // MA Cross logic if (_maCross.IsFormed) { var ma1 = _maCross.Values[0]; var ma2 = _maCross.Values[1]; var ma3 = _maCross.Values[2]; if (ma1 > ma2 && ma2 > ma3) { // Buy signal EnterLongPosition(1); } else if (ma1 < ma2 && ma2 < ma3) { // Sell signal ExitLongPosition(1); } } } else if (indicator == _atr) { // ATR logic for risk sizing if (_atr.IsFormed) { var atrValue = _atr.Value; // Use atrValue for stop loss or take profit calculation } } base.OnProcessIndicator(indicator); } // Other strategy methods like OnOrderRegistering, OnPositionChanged, etc. } ``` -------------------------------- ### Configure and Initialize ExpMaRoundingCandleMmrecStrategy in C# Source: https://github.com/stocksharp/algotrading/blob/main/API/3021_Exp_MA_Rounding_Candle_MMRec/README.md This snippet demonstrates the initialization and parameter configuration for the strategy. It involves setting the candle timeframe, smoothing methods, and trade volume to align with specific trading requirements. ```csharp var strategy = new ExpMaRoundingCandleMmrecStrategy { CandleType = TimeSpan.FromHours(1).TimeFrame(), SmoothingMethod = SmoothingType.Exponential, MaLength = 14, RoundingFactor = 0.01m, GapFilter = 0.005m, TradeVolume = 1.0m }; strategy.Start(); ```