/**TestFractalStop Developed by evge;**/ function Initialize() { StrategyName = "TestFractalStop"; AddParameter("Period", 5, "", 1); AddParameter("Take", 1, "", 1); AddInput("Input1", Inputs.Candle, 5, true, "SBER=МБ ЦК"); LongLimit = 100; ShortLimit = 100; AddGlobalVariable("L", Types.Double, 0.0); } function OnUpdate() { var F = MY.Fractal(Input1, Period)["L"]; if (!Double.IsNaN(F[Period])) L = F[Period]; if ( (Input1.Close[1] < Input1.Close[0]) && CurrentPosition() == 0 ) { EnterLong(); if (L != 0) StopLoss(L, SignalPriceType.Price); } if (CurrentPLper() >= Take && CurrentPosition() > 0) CloseLong(); }