Код: Выделить всё
/**
Hash code 33183BB5C180D78FD192EF26BB69E03E
**/
function Initialize()
{
StrategyName = "MACross";
AddParameter("PFast", 10, "", 1);
AddParameter("PSlow", 50, "", 1);
AddInput("Input1", Inputs.Candle, 1, true, "");
LongLimit = 1;
ShortLimit = -1;
AddChartIndicator("EMA", new Dictionary <string, string>{{"Period", "PFast"}});
AddChartIndicator("SMA", new Dictionary <string, string>{{"Period", "PSlow"}});
}
function OnUpdate()
{
/// ПРАВИЛО 1
if ( (CrossAbove(EMA(Input1.Close, PFast), SMA(Input1.Close, PSlow)) == true) )
{
ShowMessage("Пересекает вверх");
PlaySound(InnerSystemSounds.Beep);
}
/// ПРАВИЛО 2
if ( (CrossBelow(EMA(Input1.Close, PFast), SMA(Input1.Close, PSlow)) == true) )
{
ShowMessage("Пересекает вниз");
PlaySound(InnerSystemSounds.Beep);
}
}
Скачать скрипт стратегии (советника)