/**Скрипт для открытия позиции LONG на заданное количество при росте цены Developed by AlfaDirect; Algorithm = ПРОБОЙ;**/ function Initialize() { StrategyName = "Alfa_PC"; AddParameter("Po", 15, "", 1); AddParameter("Pc", 5, "", 1); AddInput("Input1", Inputs.Candle, 1, true, ""); LongLimit = 0; ShortLimit = 0; } function OnUpdate() { double HH = MY.PriceChannel(Input1, Po ).GetValue("Upper", 1); double LL = MY.PriceChannel(Input1, Po ).GetValue("Lower", 1); double H = MY.PriceChannel(Input1, Pc ).GetValue("Upper", 1); double L = MY.PriceChannel(Input1, Pc ).GetValue("Lower", 1); if ( CurrentPosition() == 0 && Input1.Close[0] > HH ) { EnterLong(); } if ( CurrentPosition() == 0 && Input1.Close[0] < LL ) { EnterShort(); } if ( CurrentPosition() > 0 && Input1.Close[0] < L ) { CloseLong(); } if ( CurrentPosition() < 0 && Input1.Close[0] > H ) { CloseShort(); } }