Код: Выделить всё
function Initialize()
{
StrategyName = "111";
AddParameter("P_TP", 2.0, "", 1);
AddParameter("P_chanel_per", 6, "Период 1-канала", 1);
LongLimit = 1;
ShortLimit = -1;
}
function OnUpdate()
{
double SL_long=Input1.Close-(Input1.Close-MY.PriceChannel4(Input1, P_chanel_per).GetValue("Lower", 1))-0.01;
double SL_short=Input1.Close+(Input1.Close-MY.PriceChannel4(Input1, P_chanel_per).GetValue("Upper", 1))+0.01;
/// ПРАВИЛО 1
if (
//условие
)
{
EnterShort();
BreakingStop(SL_short, P_TP, SignalPriceType.DeltaFromAveragePrice);
}
/// ПРАВИЛО 2
if (
//условие
)
{
EnterLong();
BreakingStop(SL_long, P_TP, SignalPriceType.DeltaFromAveragePrice);
}
}