Re: Несколько входных рядов в стратегиях
Добавлено: 22 апр 2021, 06:26
В новой версии АД4 (АИ) 4.0.3032.1724, по информации из обновления, некорректный ПУ исправили. Пока не проверял.
Неофициальный форум клиентского терминала Альфа-Инвестиции (Альфа-Директ 4). Обсуждение терминала, обмен опытом, разработка скриптов индикаторов и стратегий.
https://alfadirect4.ru/
Код: Выделить всё
if (CurrentPosition() > 0 && (CurrentPLper() > Zero1) && (LTRt < ((int)(AverPrice() + ((AverPrice()/100) * Stop1)))) )
{CancelStopLoss(); LTRt = (int) (AverPrice() + ((AverPrice()/100) * Stop1)); StopLoss(LTRt, SignalPriceType.Price);
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "TSL1"));
}
Код: Выделить всё
/**
**/
function Initialize()
{
StrategyName = "MyMTS65";
AddParameter("P1", 0, "", 1);
AddInput("Input1", Inputs.Candle, 5, true, "SiM1=ФОРТС");
LongLimit = 1;
ShortLimit = -1;
}
function OnUpdate()
{
var I1 = Input1;
if (CurrentPosition() > 0 && (CurrentPLper() > 0.06) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.06", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.08) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.08", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.1) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.1", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.12) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.12", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.14) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.14", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.16) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.16", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.18) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.18", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.2) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.2", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.22) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.22", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.24) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.24", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.26) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.26", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.28) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.28", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.3) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.3", CurrentPLper()));
}
if (CurrentPosition() > 0 && (CurrentPLper() > 0.32) )
{
WriteLine("C:\\TEMP\\VRat1.txt", String.Format("{0};{1};{2};{3};{4};{5};{6};{7}", I1.BarDate(), I1.BarTime(), I1.Open[0], I1.High[0], I1.Low[0], I1.Close[0], "0.32", CurrentPLper()));
}
}