Как я и думал на основе этой стратегии все же удалось создать что-то стоящее.
Применимо только к евре!!!Стратегия для Омеги,
часовки. Причем флажок на чартах в окошке "Use Natural hours bars" должен быть снят.
Код со всеми начальными установками приведен ниже.
В коде есть некие отладочные заморочки, но не обращайте на них внимания!
Вставляейте код в Омегу и торгуйте на демо
хоть до "опупения"
За реал никакой ответственности не несу
+++++++++++++++++++++++++++++++++++++++++++++++++
Inputs: RSILength(15), Level_1(59),Level_2(68), PercTrueRange(0.045),par1(0.057),par2(1), testparam(2);
Vars: StopLossBuy(0), StopLossSell(0),rsirsi(0);
Vars: bu1(0),bu2(0),sl1(0),Ssl1(0), sl2(0),sl3(0),sl4(0),se1(0),se2(0),ss1(0),ss2(0),ss3(0),ss4(0);
If Marketposition <= 0 Then StopLossBuy = 0;
If Marketposition >= 0 Then StopLossSell = 0;
rsirsi = RSI(Close, RSILength);
{+++++++++++++++++ Buy Zone +++++++++++++++++++++}
If Currentbar > 1 AND rsirsi Cross Above 50 + 2 and countif(rsirsi < 50, 19) <> 0 and Marketposition = 0
Then
begin
Buy("b1") {high + AvgTrueRange(RSILength)*PercTrueRange*2.5 { 0.0015} Limit}this bar on the close;
StopLossBuy = high - {AvgTrueRange(RSILength)*PercTrueRange*2*2.5} 0.0034 ;
end;
If Marketposition = 1 and CurrentContracts = 1 and close Crosses below StopLossBuy
Then
begin
ExitLong("sl_1") from Entry ("b1");
sl1 = sl1 + 1;
end;
If Marketposition = 1 and CurrentContracts = 1 and RSI(Close, RSILength) Cross Above Level_1
Then Buy("b2") this bar on the close;
If Marketposition = 1 and CurrentContracts = 2 and RSI(Close, RSILength) Cross below 50 + 1
Then begin ExitLong("sl_2") from Entry ("b2"); sl2 = sl2 + 1; end;
{If Marketposition = 1 and CurrentContracts = 2 and RSI(Close, RSILength) Cross below Level_2
Then begin ExitLong("sl_3") from Entry ("b2");sl3 = sl3 + 1; end;}
If Marketposition = 1 and RSI(Close, RSILength) Cross below 100 - Level_1
Then begin ExitLong("sl_4") this bar on the close; sl4 = sl4 + 1; end;
{+++++++++++++++++ Sell Zone +++++++++++++++++++++}
If Currentbar > 1 AND rsirsi Cross below 50- 2 and countif(rsirsi > 50, 19) <> 0 and Marketposition = 0
Then
begin
Sell("s1") {low - AvgTrueRange(RSILength)*0.15*2.5{ 0.0015} Limit}this bar on the close;
StopLossSell = low + {AvgTrueRange(RSILength)*PercTrueRange*2*2.5} 0.0034;
end;
If Marketposition = -1 and CurrentContracts = 1 and close Crosses above StopLossSell
Then ExitShort("ss_1") from Entry ("s1");
If Marketposition = -1 and CurrentContracts = 1 and RSI(Close, RSILength) Cross below 100 - Level_1
Then Sell("s2") this bar on the close;
If Marketposition = -1 and CurrentContracts = 2 and RSI(Close, RSILength) Cross above 50 - 1
Then ExitShort("ss_2") from Entry ("s2");
{If Marketposition = -1 and CurrentContracts = 2 and RSI(Close, RSILength) Cross above 100 - Level_2
Then ExitShort("ss_3") from Entry ("s2");}
If Marketposition = -1 and RSI(Close, RSILength) Cross above Level_1
Then ExitShort("ss_4") this bar on the close;
{ If (marketposition = -1 and 50 < rsirsi) or (marketposition = 1 and 50 > rsirsi) Then }
If RSI(Close, RSILength) < Level_2 and RSI(Close, RSILength) > 100 - Level_2 Then
begin
SetStopPosition;
SetPercentTrailing(par1, par2);
end;
SetStopPosition;
{SetStopContract;}
SetStopLoss(PercTrueRange);
{If sl4<>sl4[1] or sl3<>sl3[1] or sl2<>sl2[1] or sl1<>sl1[1] Then
Print(File("d:\data1\RSI.txt"),sl1, sl2, sl3, sl4);}
++++++++++++++++++++++++++++++++++++++++++++++
ЗЫ. Забыл... В "Strategy testing resolution" должно стоять 15 мин. "Maximum open entiers..." = 2.
"Allow for same and different..." - точка. "Max numbers of bars....." = 100. В "Costs" "Fixet Unit" - точка
PPS. Все что в "ЗЫ" - очень важно!!! Отчет из Омеги прилагается. 210 дней.
Успехов!