Simonov писал(а):Кто-то уже хвастается данным "граалем" на Смарт-Лабе. Здесь.![]()
Да да да))) смешная ветка была))) скрин зашел в тему))))
там еще вот такой скрин был)) https://smart-lab.ru/blog/484379.php#comment8704540
Simonov писал(а):Кто-то уже хвастается данным "граалем" на Смарт-Лабе. Здесь.![]()
Код: Выделить всё
function OnUpdate()
{
/// ПРАВИЛО 1
if ( (MY.SuperTrend(Input1, PeriodATR, PeriodCCI, K).GetValue("U", 1) > 0) )
{
EnterLong();
}
/// ПРАВИЛО 2
if ( (MY.SuperTrend(Input1, PeriodATR, PeriodCCI, K).GetValue("D", 1) > 0) )
{
EnterShort();
}
}
Код: Выделить всё
/**
Hash code 82E7948763EE510C8DF0B3C48F17727D
**/
function Initialize()
{
StrategyName = "SuperTrend";
AddParameter("PeriodATR", 5, "", 1);
AddParameter("PeriodCCI", 50, "", 1);
AddParameter("K", 1, "", 1);
AddParameter("SL", 1.1, "StopLoss", 1);
AddParameter("TP", 1.6, "TakeProfit", 1);
AddInput("Input1", Inputs.Candle, 60, true, "SBER=МБ ЦК");
LongLimit = 4750;
ShortLimit = -4750;
AddChartIndicator("MY.SuperTrend", new Dictionary <string, string>{{"PeriodATR", "PeriodATR"},{"PeriodCCI", "PeriodCCI"},{"K", "K"}});
AddGlobalVariable("N", Types.Int, 0);
}
function OnUpdate()
{
// evge 08.10.2019 https://alfadirect4.ru
var I = Input1;
var ST = MY.SuperTrend(Input1, PeriodATR, PeriodCCI, K);
/// ПРАВИЛО 1
if ( ST["U"][1] > 0 && N >= 0)
{
EnterLong();
BreakingStop(SL, TP, SignalPriceType.DeltaInPercentFromAveragePrice);
N = -1;
}
/// ПРАВИЛО 2
if ( ST["D"][1] > 0 && N <= 0)
{
EnterShort();
BreakingStop(SL, TP, SignalPriceType.DeltaInPercentFromAveragePrice);
N = 1;
}
}
Код: Выделить всё
function Initialize()
{
StrategyName = "SuperTrendParts";
AddParameter("PeriodATR", 4, "", 1);
AddParameter("PeriodCCI", 39, "", 1);
AddParameter("K", 1, "", 1);
AddParameter("TP", 0.5, "TakeProfit %", 1);
AddParameter("TPLot", 1000, "Lot TakeProfit", 1);
AddInput("Input1", Inputs.Candle, 60, true, "SBER=МБ ЦК");
LongLimit = 5000;
ShortLimit = -5000;
AddChartIndicator("MY.SuperTrend", new Dictionary <string, string>{{"PeriodATR", "PeriodATR"},{"PeriodCCI", "PeriodCCI"},{"K", "K"}});
AddGlobalVariable("N", Types.Int, 0);
AddGlobalVariable("Last", Types.Double, 0);
}
function OnUpdate()
{
// evge 08.10.2019 https://alfadirect4.ru
var I = Input1;
var ST = MY.SuperTrend(Input1, PeriodATR, PeriodCCI, K);
var CP = CurrentPosition();
/// ПРАВИЛО 1
if ( ST["U"][1] > 0 && N >= 0)
{
EnterLong();
Last = I.Close[0];
N = -1;
}
/// ПРАВИЛО 2
if ( ST["D"][1] > 0 && N <= 0)
{
EnterShort();
Last = I.Close[0];
N = 1;
}
if (CP > 0 && I.Close[0] > Last * (1 + TP * 0.01)) { CloseLong(TPLot); Last = I.Close[0]; }
if (CP < 0 && I.Close[0] < Last * (1 - TP * 0.01)) { CloseShort(TPLot); Last = I.Close[0]; }
}
Код: Выделить всё
function Initialize()
{
StrategyName = "SuperTrendParts2";
AddParameter("PeriodATR", 4, "", 1);
AddParameter("PeriodCCI", 39, "", 1);
AddParameter("K", 1, "", 1);
AddParameter("TP", 1, "TakeProfit %", 1);
AddParameter("TPLot", 500, "Lot TakeProfit", 1);
AddInput("Input1", Inputs.Candle, 60, true, "SBER=МБ ЦК");
LongLimit = 5000;
ShortLimit = -5000;
AddChartIndicator("MY.SuperTrend", new Dictionary <string, string>{{"PeriodATR", "PeriodATR"},{"PeriodCCI", "PeriodCCI"},{"K", "K"}});
AddGlobalVariable("N", Types.Int, 0);
AddGlobalVariable("Last", Types.Double, 0);
}
function OnUpdate()
{
// evge 08.10.2019 https://alfadirect4.ru
var I = Input1;
var ST = MY.SuperTrend(Input1, PeriodATR, PeriodCCI, K);
var CP = CurrentPosition();
/// ПРАВИЛО 1
if ( ST["U"][1] > 0 && N >= 0)
{
EnterLong();
Last = I.Close[0];
N = -1;
}
/// ПРАВИЛО 2
if ( ST["D"][1] > 0 && N <= 0)
{
EnterShort();
Last = I.Close[0];
N = 1;
}
if (CP > 0 && I.Close[0] > Last * (1 + TP * 0.01)) { CloseLong(TPLot); Last = I.Close[0]; }
if (CP > 0 && I.Close[0] < Last * (1 - TP * 0.01) && CurrentPLper() > 0) { CloseLong(TPLot); Last = I.Close[0]; }
if (CP < 0 && I.Close[0] < Last * (1 - TP * 0.01)) { CloseShort(TPLot); Last = I.Close[0]; }
if (CP < 0 && I.Close[0] > Last * (1 + TP * 0.01) && CurrentPLper() > 0) { CloseShort(TPLot); Last = I.Close[0]; }
}
Вернуться в «Пользовательские индикаторы»
Сейчас этот форум просматривают: Bing [Bot] и 6 гостей