/** Стратегия на индикаторе CCI Developed by AlfaDirect; Algorithm = КОНТРТРЕНД; Hash code 1AD5517E9589C219420FD0E48FA7A06F **/ function Initialize() { StrategyName = "Alfa_CCI_ContrTrend"; 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); } }