Membre très actif
430 messages
- Inscrit le :
- 01 Sep 2012
- Genre :
- m
- Trading :
- Réel
resultats du backtest UT 15 du 16.05.2012 a aujourdh'ui sur l'euro /usd
Bars en test 9271
Ticks modelés 18442
Qualité du modelage n/a
Erreurs des graphiques désaccordés 0
Dépot initial 10000.00
Profit total net 508136.80
Profit brut 731845.60
Perte brute -223708.80
Facteur de profit 3.27
Rémunération espérée 1770.51
Chute absolue 0.00
Chute maximal (%) 34154.16 (18.15%)
Enfoncement relatif 37.80% (11517.72)
Total des Trades 287
Positions SHORT (vente) gagnées % 47 (57.45%)
Positions LONG (achat) gagnées % 240 (21.67%)
Profits des Trades (% du total) 79 (27.53%)
Pertes des Trades (% du total) 208 (72.47%)
Le plus large
gains par Trade 38207.16
pertes par Trade -16100.00
Average (moyenne)
gains par Trade 9263.87
pertes par Trade -1075.52
Maximum
gains consecutifs (profit en $) 6 (26505.08)
pertes consecutives (perte en $) 28 (-4810.44)
Maximal
Gains consecutifs (coups gagnants) 101806.80 (3)
Pertes consecutives (coups perdants) -19893.44 (2)
Average (moyenne)
gains consecutifs 2
Pertes consecutives 6
Voici programmes avec les parametres de mon backtest
Code
//+------------------------------------------------------------------+
//| CAC40.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#include <stdlib.mqh>
#include <WinUser32.mqh>
// exported variables
extern string S1="---- Horaires du lundi ouverture ROBOT ------";
extern bool Monday39 = true;
extern int HoursFrom48 = 0;
extern int HoursTo48 = 24;
extern string S2="------ Horaires ouverture du vendredi ROBOT ------";
extern bool Friday22 = true;
extern int HoursFrom47 = 21;
extern int HoursTo47 = 18;
extern string S4="--- Horaires ouverture du mardi au jeudi ROBOT ---";
extern bool Tuesday11 = true;
extern bool Wednesday11 = true;
extern bool Thursday11 = true;
extern int HoursFrom46 = 16;
extern int HoursTo46 = 14;
extern string S5="--- Horaires du vendredi fermeture ROBOT ------";
extern bool Friday41 = true;
extern int HoursFrom40 = 19;
extern int HoursTo40 = 24;
extern string S6="--------- LOT ET SLIPPAGE ----------";
extern double BuyLots30 = 10.2;
extern int BuySlippage30 = 3;
extern double SellLots31 = 10.2;
extern int SellSlippage31 = 3;
extern double BuyLots84 = 10.2;
extern int BuySlippage84 = 3;
extern double SellLots85 =10.2;
extern int SellSlippage85 = 3;
extern double BuyLots129 = 7.8;
extern int BuySlippage129 = 3;
extern double SellLots126 = 7;
extern int SellSlippage126 = 3;
extern double BuyLots161 = 10.2;
extern int BuySlippage161 = 3;
extern double SellLots160 = 9.8;
extern int SellSlippage160 = 3;
extern string S11="--------- PARAMETRES INTERNES ----------";
extern string S12="--------- MA ----------";
extern int PERMA268 =153;
extern int PERMA256 =136;
extern int PERMA295 =288;
extern int PERMA243 =384;
extern int PERMA158 =142;
extern int PERMA305=342;
extern int PERMA391=374;
extern int PERMA115 =43;
extern string S113="--------- RSI ----------";
extern int PERSI319 =84;
extern int PERSI14 =84;
extern int PERSI277 =140;
extern int PERSI292 =128;
extern int PERSI18 =64;
extern int PERSI137=116;
extern int PERSI114=196;
extern int PERSI248=212;
extern int PERSI1=0;
extern string S14="--------- WPR ----------";
extern int PERWPR319 =500;
extern int PERWPR10 =488;
extern int PERWPR428 =408;
extern int PERWPR600 =336;
extern int PERWPR458 =388;
extern int PERWPR389 =384;
extern int PERWPR484 =244;
extern int PERWPR64 =356;
extern string S15="--------- CCI ----------";
extern int PERCCI427 =20;
extern int PERCCI330 =52;
extern int PERCCI15 =52;
extern int PERCCI1 =252;
extern int PERCCI01 =224;
extern int PERCCI5 =432;
extern int PERCCI001 =64;
extern int PERCCI118 =380;
// local variables
double PipValue=1; // this variable is here to support 5-digit brokers
bool Terminated = false;
string LF = "\n"; // use this in custom or utility blocks where you need line feeds
int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks
int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names
int current = 0;
extern string S7="--- ROBOT A BUY ET SELL ---";
extern bool ROBOTABUY=true;
extern bool ROBOTASELL=true;
extern string S8="--- ROBOT B BUY ET SELL ---";
extern bool ROBOTBBUY=true;
extern bool ROBOTBSELL=true;
extern string S9="--- ROBOT C BUY ET SELL ---";
extern bool ROBOTCBUY=true;
extern bool ROBOTCSELL=true;
extern string S10="--- ROBOT D BUY ET SELL ---";
extern bool ROBOTDBUY=true;
extern bool ROBOTDSELL=true;
int init()
{
NDigits = Digits;
if (false) ObjectsDeleteAll(); // clear the chart
Comment(""); // clear the chart
}
// Expert start
int start()
{
if (Bars < 10)
{
Comment("Not enough bars");
return (0);
}
if (Terminated == true)
{
Comment("EA Terminated.");
return (0);
}
OnEveryTick3();
}
void OnEveryTick3()
{
if (true == false && true) PipValue = 10;
if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10;
WeekdayFilter39();
CustomCode59();
WeekdayFilter41();
TechnicalAnalysis2x49();
TechnicalAnalysis2x52();
TechnicalAnalysis2x88();
TechnicalAnalysis2x89();
TechnicalAnalysis2x136();
TechnicalAnalysis2x137();
TechnicalAnalysis2x172();
TechnicalAnalysis2x173();
}
void WeekdayFilter39()
{
if ((Monday39 && DayOfWeek() == 1) || (true && DayOfWeek() == 2) || (true && DayOfWeek() == 3) ||
(true && DayOfWeek() == 4) || (true && DayOfWeek() == 5) || (true && DayOfWeek() == 6) || (true && DayOfWeek() == 0))
{
HoursFilter48();
}
}
void HoursFilter48()
{
int datetime800 = TimeLocal();
int hour0 = TimeHour(datetime800);
if ((HoursFrom48 < HoursTo48 && hour0 >= HoursFrom48 && hour0 < HoursTo48) ||
(HoursFrom48 > HoursTo48 && (hour0 < HoursTo48 || hour0 >= HoursFrom48)))
{
WeekdayFilter22();
}
}
void WeekdayFilter22()
{
if ((true && DayOfWeek() == 1) || (true && DayOfWeek() == 2) || (true && DayOfWeek() == 3) ||
(true && DayOfWeek() == 4) || (Friday22 && DayOfWeek() == 5) || (true && DayOfWeek() == 6) || (true && DayOfWeek() == 0))
{
HoursFilter47();
}
}
void HoursFilter47()
{
int datetime800 = TimeLocal();
int hour0 = TimeHour(datetime800);
if ((HoursFrom47 < HoursTo47 && hour0 >= HoursFrom47 && hour0 < HoursTo47) ||
(HoursFrom47 > HoursTo47 && (hour0 < HoursTo47 || hour0 >= HoursFrom47)))
{
WeekdayFilter11();
}
}
void WeekdayFilter11()
{
if ((true && DayOfWeek() == 1) || (Tuesday11 && DayOfWeek() == 2) || (Wednesday11 && DayOfWeek() == 3) ||
(Thursday11 && DayOfWeek() == 4) || (true && DayOfWeek() == 5) || (true && DayOfWeek() == 6) || (true && DayOfWeek() == 0))
{
HoursFilter46();
}
}
void HoursFilter46()
{
int datetime800 = TimeLocal();
int hour0 = TimeHour(datetime800);
if ((HoursFrom46 < HoursTo46 && hour0 >= HoursFrom46 && hour0 < HoursTo46) ||
(HoursFrom46 > HoursTo46 && (hour0 < HoursTo46 || hour0 >= HoursFrom46)))
{
CustomIf55();
CustomIf58();
CustomIf69();
CustomIf70();
CustomIf119();
CustomIf118();
CustomIf164();
CustomIf165();
}
}
void CustomIf55()
{
if (ROBOTABUY == true)
{
TechnicalAnalysis2x62();
}
}
void TechnicalAnalysis2x62()
{
if ((iRSI(NULL, NULL,PERSI18,PRICE_CLOSE,1) < 50) && (iRSI(NULL, NULL,PERSI137,PRICE_CLOSE,0) > 50))
{
IfOrderDoesNotExist10();
}
}
void IfOrderDoesNotExist10()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode56();
}
}
void CustomCode56()
{
ROBOTABUY=true;
BuyOrder30();
}
void BuyOrder30()
{
double SL = Ask - 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Ask + 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots30, Ask, BuySlippage30, 0, 0, "My Expert", 1, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots30, Ask, BuySlippage30, SL, TP, "My Expert", 1, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf58()
{
if (ROBOTASELL == true)
{
TechnicalAnalysis2x1();
}
}
void TechnicalAnalysis2x1()
{
if ((iRSI(NULL, NULL,PERSI319,PRICE_CLOSE,1) > 50) && (iRSI(NULL, NULL,PERSI14,PRICE_CLOSE,0) < 50))
{
IfOrderDoesNotExist29();
}
}
void IfOrderDoesNotExist29()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode57();
}
}
void CustomCode57()
{
ROBOTASELL=true;
SellOrder31();
}
void SellOrder31()
{
double SL = Bid + 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Bid - 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, SellLots31, Bid, SellSlippage31, 0, 0, "My Expert", 1, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, SellLots31, Bid, SellSlippage31, SL, TP, "My Expert", 1, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf69()
{
if (ROBOTBBUY == true)
{
TechnicalAnalysis2x60();
}
}
void TechnicalAnalysis2x60()
{
if ((iWPR(NULL, NULL,PERWPR319,1) < -50) && (iWPR(NULL, NULL,PERWPR10,0) > -50))
{
IfOrderDoesNotExist67();
}
}
void IfOrderDoesNotExist67()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode73();
}
}
void CustomCode73()
{
ROBOTBBUY=true;
BuyOrder84();
}
void BuyOrder84()
{
double SL = Ask - 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Ask + 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots84, Ask, BuySlippage84, 0, 0, "My Expert", 2, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots84, Ask, BuySlippage84, SL, TP, "My Expert", 2, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf70()
{
if (ROBOTBSELL == true)
{
TechnicalAnalysis2x64();
}
}
void TechnicalAnalysis2x64()
{
if ((iWPR(NULL, NULL,PERWPR428,1) > -50) && (iWPR(NULL, NULL,PERWPR600,0) < -50))
{
IfOrderDoesNotExist71();
}
}
void IfOrderDoesNotExist71()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode72();
}
}
void CustomCode72()
{
ROBOTBSELL=true;
SellOrder85();
}
void SellOrder85()
{
double SL = Bid + 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Bid - 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, SellLots85, Bid, SellSlippage85, 0, 0, "My Expert", 2, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, SellLots85, Bid, SellSlippage85, SL, TP, "My Expert", 2, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf119()
{
if (ROBOTCBUY == true)
{
TechnicalAnalysis2x132();
}
}
void TechnicalAnalysis2x132()
{
if ((iCCI(NULL, NULL,PERCCI427,PRICE_CLOSE,1) < 0) && (iCCI(NULL, NULL,PERCCI330,PRICE_CLOSE,0) > 0))
{
IfOrderDoesNotExist128();
}
}
void IfOrderDoesNotExist128()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode115();
}
}
void CustomCode115()
{
ROBOTCBUY=true;
BuyOrder129();
}
void BuyOrder129()
{
double SL = Ask - 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Ask + 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots129, Ask, BuySlippage129, 0, 0, "My Expert", 3, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots129, Ask, BuySlippage129, SL, TP, "My Expert", 3, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf118()
{
if (ROBOTCSELL == true)
{
TechnicalAnalysis2x133();
}
}
void TechnicalAnalysis2x133()
{
if ((iCCI(NULL, NULL,PERCCI5,PRICE_CLOSE,1) > 0) && (iCCI(NULL, NULL,PERCCI1,PRICE_CLOSE,0) < 0))
{
IfOrderDoesNotExist127();
}
}
void IfOrderDoesNotExist127()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode112();
}
}
void CustomCode112()
{
ROBOTCSELL=true;
SellOrder126();
}
void SellOrder126()
{
double SL = Bid + 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Bid - 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, SellLots126, Bid, SellSlippage126, 0, 0, "My Expert", 3, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, SellLots126, Bid, SellSlippage126, SL, TP, "My Expert", 3, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf164()
{
if (ROBOTDBUY == true)
{
TechnicalAnalysis2x162();
}
}
void TechnicalAnalysis2x162()
{
if ((iMA(NULL, NULL,PERMA268,0,MODE_SMA,PRICE_CLOSE,1) < iMA(NULL, NULL,PERMA256,0,MODE_SMA,PRICE_CLOSE,1)) && (iMA(NULL, NULL,PERMA268,0,MODE_SMA,PRICE_CLOSE,0) > iMA(NULL, NULL,PERMA256,0,MODE_SMA,PRICE_CLOSE,0)))
{
IfOrderDoesNotExist157();
}
}
void IfOrderDoesNotExist157()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode156();
}
}
void CustomCode156()
{
ROBOTDBUY=true;
BuyOrder161();
}
void BuyOrder161()
{
double SL = Ask - 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Ask + 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_BUY, BuyLots161, Ask, BuySlippage161, 0, 0, "My Expert", 4, 0, Blue);
else
ticket = OrderSend(Symbol(), OP_BUY, BuyLots161, Ask, BuySlippage161, SL, TP, "My Expert", 4, 0, Blue);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomIf165()
{
if (ROBOTDSELL == true)
{
TechnicalAnalysis2x163();
}
}
void TechnicalAnalysis2x163()
{
if ((iMA(NULL, NULL,PERMA295,0,MODE_SMA,PRICE_CLOSE,1) > iMA(NULL, NULL,PERMA243,0,MODE_SMA,PRICE_CLOSE,1)) && (iMA(NULL, NULL,PERMA295,0,MODE_SMA,PRICE_CLOSE,0) < iMA(NULL, NULL,PERMA243,0,MODE_SMA,PRICE_CLOSE,0)))
{
IfOrderDoesNotExist158();
}
}
void IfOrderDoesNotExist158()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists == false)
{
CustomCode159();
}
}
void CustomCode159()
{
ROBOTDSELL=true;
SellOrder160();
}
void SellOrder160()
{
double SL = Bid + 0*PipValue*Point;
if (0 == 0) SL = 0;
double TP = Bid - 0*PipValue*Point;
if (0 == 0) TP = 0;
int ticket = -1;
if (true)
ticket = OrderSend(Symbol(), OP_SELL, SellLots160, Bid, SellSlippage160, 0, 0, "My Expert", 4, 0, Red);
else
ticket = OrderSend(Symbol(), OP_SELL, SellLots160, Bid, SellSlippage160, SL, TP, "My Expert", 4, 0, Red);
if (ticket > -1)
{
if (true)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}
void CustomCode59()
{
}
void WeekdayFilter41()
{
if ((false && DayOfWeek() == 1) || (false && DayOfWeek() == 2) || (false && DayOfWeek() == 3) ||
(false && DayOfWeek() == 4) || (Friday41 && DayOfWeek() == 5) || (false && DayOfWeek() == 6) || (false && DayOfWeek() == 0))
{
HoursFilter40();
}
}
void HoursFilter40()
{
int datetime800 = TimeLocal();
int hour0 = TimeHour(datetime800);
if ((HoursFrom40 < HoursTo40 && hour0 >= HoursFrom40 && hour0 < HoursTo40) ||
(HoursFrom40 > HoursTo40 && (hour0 < HoursTo40 || hour0 >= HoursFrom40)))
{
IfOrderExists18();
IfOrderExists23();
IfOrderExists25();
IfOrderExists28();
IfOrderExists100();
IfOrderExists103();
IfOrderExists114();
IfOrderExists101();
}
}
void IfOrderExists18()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder19();
}
}
void CloseOrder19()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists23()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder24();
}
}
void CloseOrder24()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists25()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder26();
}
}
void CloseOrder26()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists28()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder27();
}
}
void CloseOrder27()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists100()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder106();
}
}
void CloseOrder106()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 3)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists103()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder110();
}
}
void CloseOrder110()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 3)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists114()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder117();
}
}
void CloseOrder117()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 4)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void IfOrderExists101()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder109();
}
}
void CloseOrder109()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 4)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x49()
{
if ((iRSI(NULL, NULL,PERSI248,PRICE_CLOSE,1) < 50) && (iRSI(NULL, NULL,PERSI1,PRICE_CLOSE,0) > 50))
{
IfOrderExists50();
}
}
void IfOrderExists50()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder51();
}
}
void CloseOrder51()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x52()
{
if ((iRSI(NULL, NULL,PERSI277,PRICE_CLOSE,1) > 50) && (iRSI(NULL, NULL,PERSI292,PRICE_CLOSE,0) < 50))
{
IfOrderExists53();
}
}
void IfOrderExists53()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder54();
}
}
void CloseOrder54()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x88()
{
if ((iWPR(NULL, NULL,PERWPR458,1) < -50) && (iWPR(NULL, NULL,PERWPR389,0) > -50))
{
IfOrderExists91();
}
}
void IfOrderExists91()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder94();
}
}
void CloseOrder94()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x89()
{
if ((iWPR(NULL, NULL,PERWPR484,1) > -50) && (iWPR(NULL, NULL,PERWPR64,0) < -50))
{
IfOrderExists90();
}
}
void IfOrderExists90()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder93();
}
}
void CloseOrder93()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 2)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x136()
{
if ((iCCI(NULL, NULL,PERCCI01,PRICE_CLOSE,1) < 0) && (iCCI(NULL, NULL,PERCCI5,PRICE_CLOSE,0) > 0))
{
IfOrderExists139();
}
}
void IfOrderExists139()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder141();
}
}
void CloseOrder141()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 3)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x137()
{
if ((iCCI(NULL, NULL,PERCCI1,PRICE_CLOSE,1) > 0) && (iCCI(NULL, NULL,PERCCI118,PRICE_CLOSE,0) < 0))
{
IfOrderExists138();
}
}
void IfOrderExists138()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 3)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder140();
}
}
void CloseOrder140()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 3)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x172()
{
if ((iMA(NULL, NULL,PERMA158,0,MODE_SMA,PRICE_CLOSE,1) > iMA(NULL, NULL,PERMA305,0,MODE_SMA,PRICE_CLOSE,1)) && (iMA(NULL, NULL,PERMA158,0,MODE_SMA,PRICE_CLOSE,0) < iMA(NULL, NULL,PERMA305,0,MODE_SMA,PRICE_CLOSE,0)))
{
IfOrderExists171();
}
}
void IfOrderExists171()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder168();
}
}
void CloseOrder168()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 4)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
void TechnicalAnalysis2x173()
{
if ((iMA(NULL, NULL,PERMA391,0,MODE_SMA,PRICE_CLOSE,1) < iMA(NULL, NULL,PERMA115,0,MODE_SMA,PRICE_CLOSE,1)) && (iMA(NULL, NULL,PERMA391,0,MODE_SMA,PRICE_CLOSE,0) > iMA(NULL, NULL,PERMA115,0,MODE_SMA,PRICE_CLOSE,0)))
{
IfOrderExists169();
}
}
void IfOrderExists169()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 4)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
if (exists)
{
CloseOrder170();
}
}
void CloseOrder170()
{
int orderstotal = OrdersTotal();
int orders = 0;
int ordticket[30][2];
for (int i = 0; i < orderstotal; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 4)
{
continue;
}
ordticket[orders][0] = OrderOpenTime();
ordticket[orders][1] = OrderTicket();
orders++;
}
if (orders > 1)
{
ArrayResize(ordticket,orders);
ArraySort(ordticket);
}
for (i = 0; i < orders; i++)
{
if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
{
bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 3, Red);
if (ret == false)
Print("OrderClose() error - ", ErrorDescription(GetLastError()));
}
}
}
int deinit()
{
if (false) ObjectsDeleteAll();
}