/** Стратегия на индикаторе CCI Developed by AlfaDirect; Algorithm = ТРЕНД; Hash code BA0E85A9229488BE083F30932479CF22 **/ function Initialize() { StrategyName = "Alfa_CCI"; AddParameter("Pcci", 100, "", 1); AddParameter("Pstop", 2, "", 1); AddInput("Input1", Inputs.Candle, 60, true, "GAZP=МБ ЦК"); LongLimit = 1; ShortLimit = -1; } function OnUpdate() { /// ПРАВИЛО 1 if ( (CCI(Input1, Pcci) > 100) && (CCI(Input1, Pcci)[1] <= 100) ) { EnterLong(); StopLoss(Pstop, SignalPriceType.DeltaInPercentFromAveragePrice); } /// ПРАВИЛО 2 if ( (CCI(Input1, Pcci) < -100) && (CCI(Input1, Pcci)[1] >= -100) ) { EnterShort(); StopLoss(Pstop, SignalPriceType.DeltaInPercentFromAveragePrice); } }