Bonjour
J'utilise ce programme que j'ai légèrement modifié sur des unites de temps différentes
Ces différents programmes sont très performants dans chaque unite de temps pris individuellement
Je voudrais réunir sur un seul programmes toutes les unites de temps en utilisant la fonction || (ou) de telle manière que les trades se fassent en permanence dès qu'une configuration se présente dans une quelconque unite de temps
J'ai fais de mon mieux mais je me retrouve avec 15 erreurs que je n'arrive pas a corriger ....et d'autre part je me demande si l'on ne peut pas faire plus simple comme programme
Merci d'avance pour votre aide
J'utilise ce programme que j'ai légèrement modifié sur des unites de temps différentes
Ces différents programmes sont très performants dans chaque unite de temps pris individuellement
Je voudrais réunir sur un seul programmes toutes les unites de temps en utilisant la fonction || (ou) de telle manière que les trades se fassent en permanence dès qu'une configuration se présente dans une quelconque unite de temps
J'ai fais de mon mieux mais je me retrouve avec 15 erreurs que je n'arrive pas a corriger ....et d'autre part je me demande si l'on ne peut pas faire plus simple comme programme
Merci d'avance pour votre aide
Code
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| GAPS MTF |
//| SFK Corp. |
//+------------------------------------------------------------------+
#property copyright "SFK Corp."
#property link ""
//---- input parameters
extern int min_gapsizePERIOD_M1 = 6;
extern int min_gapsizePERIOD_M5 = 6;
extern int min_gapsizePERIOD_M15 = 6;
extern int min_gapsizePERIOD_M30 = 6;
extern int min_gapsizePERIOD_H1 = 6;
extern int min_gapsizePERIOD_H4 = 6;
//
extern double lotsize_gapPERIOD_M1 = 0.4;
extern double lotsize_gapPERIOD_M5 = 0.4;
extern double lotsize_gapPERIOD_M15 = 0.4;
extern double lotsize_gapPERIOD_M30 = 0.4;
extern double lotsize_gapPERIOD_H1 = 0.4;
extern double lotsize_gapPERIOD_H4 = 0.4;
//----
datetime order_time = 0;
extern bool PERIOD_M1=true;
extern bool PERIOD_M5=true;
extern bool PERIOD_M15=true;
extern bool PERIOD_M30=true;
extern bool PERIOD_H1=true;
extern bool PERIOD_H4=true;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
// Defining the variables to decide.
Print("order time", order_time);
// double current_openprice = iOpen(Symbol(),PERIOD_M15, 0);
// double previous_highprice = iHigh(Symbol(),PERIOD_M15, 1);
// double previous_lowprice = iLow(Symbol(),PERIOD_M15, 1);
// double point_gap = MarketInfo(Symbol(), MODE_POINT);
// int spread_gap = MarketInfo(Symbol(), MODE_SPREAD);
// datetime current_time = iTime(Symbol(),PERIOD_M15, 0);
// catching the gap on sell upper gap
if(iOpen(Symbol(), PERIOD_M1, 0) > iHigh(Symbol(), PERIOD_M1, 1) + (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_M1, 0) != order_time)
||(iOpen(Symbol(), PERIOD_M5, 0) > iHigh(Symbol(), PERIOD_M5, 1) + (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_M5, 0) != order_time)
||(iOpen(Symbol(), PERIOD_M15, 0) > iHigh(Symbol(), PERIOD_M15, 1) + (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_M15, 0) != order_time)
||(iOpen(Symbol(), PERIOD_M30, 0) > iHigh(Symbol(), PERIOD_M30, 1) + (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_M30, 0) != order_time)
||(iOpen(Symbol(), PERIOD_H1 ,0) > iHigh(Symbol(), PERIOD_H1, 1) + (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_H1, 0) != order_time)
||(iOpen(Symbol(), PERIOD_H4, 0) > iHigh(Symbol(), PERIOD_H4, 1) + (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
iTime(Symbol(), PERIOD_H4, 0) != order_time))
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_M1, Bid, 0, 0,
iHigh(Symbol(), PERIOD_M1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_M1, 0);
Print("I am inside (sell) :-)", order_time);
//----
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_M5, Bid, 0, 0,
iHigh(Symbol(), PERIOD_M5, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_M5, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_M15, Bid, 0, 0,
iHigh(Symbol(), PERIOD_M15, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_M15, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_M30, Bid, 0, 0,
iHigh(Symbol(), PERIOD_M30, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_M30, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_H1, Bid, 0, 0,
iHigh(Symbol(), PERIOD_H1, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_H1, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gapPERIOD_H4, Bid, 0, 0,
iHigh(Symbol(), PERIOD_H4, 1) + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 4, 0, Red);
order_time = iTime(Symbol(), PERIOD_H4, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
//catching the gap on buy down gap
if(iOpen(Symbol(), PERIOD_M1, 0) < iLow(Symbol(), PERIOD_M1, 1) - (min_gapsizePERIOD_M1 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
||iTime(Symbol(), PERIOD_M1, 0) != order_time)
(iOpen(Symbol(), PERIOD_M5, 0) < iLow(Symbol(), PERIOD_M5, 1) - (min_gapsizePERIOD_M5 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
|| iTime(Symbol(), PERIOD_M5, 0) != order_time)
(iOpen(Symbol(), PERIOD_M15, 0) < iLow(Symbol(), PERIOD_M15, 1) - (min_gapsizePERIOD_M15 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
|| iTime(Symbol(), PERIOD_M15, 0) != order_time)
(iOpen(Symbol(), PERIOD_M30, 0) < iLow(Symbol(), PERIOD_M30, 1) - (min_gapsizePERIOD_M30 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
|| iTime(Symbol(), PERIOD_M30, 0) != order_time)
(iOpen(Symbol(), PERIOD_H1, 0) < iLow(Symbol(), PERIOD_H1, 1) - (min_gapsizePERIOD_H1 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
|| iTime(Symbol(), PERIOD_H1, 0) != order_time)
(iOpen(Symbol(), PERIOD_H4, 0) < iLow(Symbol(), PERIOD_H4, 1) - (min_gapsizePERIOD_H4 + MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT)&&
|| iTime(Symbol(), PERIOD_H4, 0) != order_time))
// if(current_openprice < previous_lowprice - (min_gapsize + spread_gap)*point_gap &&
// current_time != order_time)
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_M1, Ask, 0, 0,
iLow(Symbol(), PERIOD_M1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_M1, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_M5, Ask, 0, 0,
iLow(Symbol(), PERIOD_M5, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_M5, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_M15, Ask, 0, 0,
iLow(Symbol(), PERIOD_M15, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_M15, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_M30, Ask, 0, 0,
iLow(Symbol(), PERIOD_M30, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_M30, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_H1, Ask, 0, 0,
iLow(Symbol(), PERIOD_H1, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_H1, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gapPERIOD_H4, Ask, 0, 0,
iLow(Symbol(), PERIOD_H4, 1) - MarketInfo(Symbol(), MODE_SPREAD)*MarketInfo(Symbol(), MODE_POINT),
"", 5, 0, Green);
order_time = iTime(Symbol(), PERIOD_H4, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
[[[[Voici le programme original sur une unite de temps 1 minute sur EURUSD]]]]
//+------------------------------------------------------------------+
//|Gap 1 minutes
//|
//+------------------------------------------------------------------+
#property copyright "QPG Gap 1 minutes."
#property link ""
//---- input parameters
extern int min_gapsize = 6;
extern double lotsize_gap = 0.01;
//----
datetime order_time = 0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
// Defining the variables to decide.
Print("order time", order_time);
double current_openprice = iOpen(Symbol(),PERIOD_M1, 0);
double previous_highprice = iHigh(Symbol(),PERIOD_M1, 1);
double previous_lowprice = iLow(Symbol(),PERIOD_M1, 1);
double point_gap = MarketInfo(Symbol(), MODE_POINT);
int spread_gap = MarketInfo(Symbol(), MODE_SPREAD);
datetime current_time = iTime(Symbol(),PERIOD_M1, 0);
// catching the gap on sell upper gap
if(current_openprice > previous_highprice + (min_gapsize + spread_gap)*point_gap &&
current_time != order_time)
{
int ticket = OrderSend(Symbol(), OP_SELL, lotsize_gap, Bid, 0, 0,
previous_highprice + spread_gap*point_gap,
"", 4, 0, Red);
order_time = iTime(Symbol(),PERIOD_M1, 0);
Print("I am inside (sell) :-)", order_time);
//----
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
//catching the gap on buy down gap
if(current_openprice < previous_lowprice - (min_gapsize + spread_gap)*point_gap &&
current_time != order_time)
{
ticket = OrderSend(Symbol(), OP_BUY, lotsize_gap, Ask, 0, 0,
previous_lowprice - spread_gap*point_gap,
"", 5, 0, Green);
order_time = iTime(Symbol(),PERIOD_M1, 0);
Print("I am inside (buy) :-)", order_time);
if(ticket < 0)
{
Print("OrderSend failed with error #", GetLastError());
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Modifié le 2018-07-03 15:00:06 par
AliX