Robot video explicative - realisation d'un programme

Présentation, Développement, Améliorations et Ressources pour les Stratégies de Trading Automatique.

Modérateur : Administrateurs

Message
Auteur
lefeuvr3
Nouveau
Messages : 8
Inscription : 05 nov. 2012, 16:53

Robot video explicative - realisation d'un programme

#1 Message par lefeuvr3 »

Initiation au trading automatisé; video explicative - réalisation du programme

Un EA ,maison, qui travaille avec rigueur et sans emotions...Amis traders , lancez vous dans la programmation

Trader un metier en voie de disparition ...remplacés par des robots bridés et securisés qui ne demandent aucun salaire et aucune prime et ne paient aucune charges sociales

Resultats du backtest , realisé à partir d'un petit programme maison, UT 15 du 16.05.2012 a aujourd'hui sur l'Euro /USD
Ici,poussé à son maximun !

[img]http://4.bp.blogspot.com/-8z008MKoJMk/U ... 1.2012.jpg [/img]
Bars en test 9271
Ticks modelés 18442
Qualité du modelage n/a
Erreurs des graphiques désaccordés 0
[color=#0000FF] Dépot initial 10000.00[/color]

Profit total net 508136.80

[b][color=#FF0000]soit un profit de ... 5081.36 % ... en presque 6 mois[/color] :mrgreen: [/b]

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

Amis Traders essayez vous même de mettre au point une strategie :idea: puis de la programmer :arrow:
Cela n'est pas tres difficile avec un builder :lol:
Voici une petite video didactique pour réaliser le plus simple des robots vous même

[url] http://glefeuvre007.blogspot.fr/2012/11 ... gueur.html[/url]
[url]http://youtu.be/yE6cINJVids[/url]
Cette vidéo montre comment en moins de 15 minutes( sur Metatrader MQL 4)

- Batir un programme simple à l'aide d'un EA.Builder ( Achat et Vente au croisement de 2 moyennes mobiles...dans un sens et dans l'autre )
- Deplacer ce programme dans Metaeditor
- Adopter quelques modifications dans le programme pour pouvoir effecteur des Backtests à la recherche des meilleurs paramètres
- Effectuer ensuite des backtests pour avoir les meilleurs paramètres

La démarche pas à pas version écrite

Programme réalisé dans la vidéo avant le Backtest ( en couleur les modifications adoptées)


[code]
//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder |
//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//| |
//| In no event will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+

#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL 2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4

#property copyright "Expert Advisor Builder"
#property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"

extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = 1.0;
extern int Slippage = 3;
extern bool UseStopLoss = False;
extern int StopLoss = 30;
extern bool UseTakeProfit = False;
extern int TakeProfit = 60;
extern bool UseTrailingStop = False;
extern int TrailingStop = 30;

extern int MA14 = 14;
extern int MA28 = 28 ;

int BarCount;
int Current;
bool TickCheck = False;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() {
BarCount = Bars;

if (EachTickMode) Current = 0; else Current = 1;

return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
int Order = SIGNAL_NONE;
int Total, Ticket;
double StopLossLevel, TakeProfitLevel;



if (EachTickMode && Bars != BarCount) TickCheck = False;
Total = OrdersTotal();
Order = SIGNAL_NONE;

//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+


double Buy1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Buy1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Buy2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Buy2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double Sell1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Sell1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double Sell2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double Sell2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseBuy1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseBuy2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double CloseBuy2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);

double CloseSell1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
double CloseSell2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
double CloseSell2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);


//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+

//Check position
bool IsTrade = False;

for (int i = 0; i < Total; i ++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { IsTrade = True; if(OrderType() == OP_BUY) { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Buy) | //+------------------------------------------------------------------+ if (CloseBuy1_1 > CloseBuy1_2 && CloseBuy2_1 < CloseBuy2_2) Order = SIGNAL_CLOSEBUY; //+------------------------------------------------------------------+ //| Signal End(Exit Buy) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; } //Trailing stop if(UseTrailingStop && TrailingStop > 0) {
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
if(OrderStopLoss() < Bid - Point * TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen); if (!EachTickMode) BarCount = Bars; continue; } } } } else { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Sell) | //+------------------------------------------------------------------+ if (CloseSell1_1 < CloseSell1_2 && CloseSell2_1 > CloseSell2_2) Order = SIGNAL_CLOSESELL;


//+------------------------------------------------------------------+
//| Signal End(Exit Sell) |
//+------------------------------------------------------------------+

if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
if (!EachTickMode) BarCount = Bars;
IsTrade = False;
continue;
}
//Trailing stop
if(UseTrailingStop && TrailingStop > 0) {
if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
if (!EachTickMode) BarCount = Bars;
continue;
}
}
}
}
}
}

//+------------------------------------------------------------------+
//| Signal Begin(Entry) |
//+------------------------------------------------------------------+

if (Buy1_1 < Buy1_2 && Buy2_1 > Buy2_2) Order = SIGNAL_BUY;

if (Sell1_1 > Sell1_2 && Sell2_1 < Sell2_2) Order = SIGNAL_SELL; //+------------------------------------------------------------------+ //| Signal End | //+------------------------------------------------------------------+ //Buy if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { if(!IsTrade) { //Check free margin if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0; if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0; Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue); if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("BUY order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
} else {
Print("Error opening BUY order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}

//Sell
if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
if(!IsTrade) {
//Check free margin
if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0; if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0; Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink); if(Ticket > 0) {
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
Print("SELL order opened : ", OrderOpenPrice());
if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
} else {
Print("Error opening SELL order : ", GetLastError());
}
}
if (EachTickMode) TickCheck = True;
if (!EachTickMode) BarCount = Bars;
return(0);
}
}

if (!EachTickMode) BarCount = Bars;

return(0);
}
//+------------------------------------------------------------------+

[/code]
[img]
http://4.bp.blogspot.com/-09yBMWFG-Ck/U ... obot.2.jpg [/img]
[b][color=#800000]Attention de ne pas se tromper dans le programme certains robots sont nettement moins efficaces pour le trading automatisé ![/color][/b]

lefeuvr3
Nouveau
Messages : 8
Inscription : 05 nov. 2012, 16:53

Re: Robot video explicative - realisation d'un programme

#2 Message par lefeuvr3 »

Initiation au trading automatisé; video explicative - réalisation du programme

Un EA ,maison, qui travaille avec rigueur et sans emotions...Amis traders , lancez vous dans la programmation

Trader un metier en voie de disparition ...remplacés par des robots bridés et securisés qui ne demandent aucun salaire et aucune prime et ne paient aucune charges sociales

Resultats du backtest , realisé à partir d'un petit programme maison, UT 15 du 16.05.2012 a aujourd'hui sur l'Euro /USD
Ici,poussé à son maximun !

Image
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

soit un profit de ... 5081.36 % ... en presque 6 mois :mrgreen:

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

Amis Traders essayez vous même de mettre au point une strategie :idea: puis de la programmer :arrow:
Cela n'est pas tres difficile avec un builder :lol:
Voici une petite video didactique pour réaliser le plus simple des robots vous même

http://glefeuvre007.blogspot.fr/2012/11 ... gueur.html
http://youtu.be/yE6cINJVids
Cette vidéo montre comment en moins de 15 minutes( sur Metatrader MQL 4)

- Batir un programme simple à l'aide d'un EA.Builder ( Achat et Vente au croisement de 2 moyennes mobiles...dans un sens et dans l'autre )
- Deplacer ce programme dans Metaeditor
- Adopter quelques modifications dans le programme pour pouvoir effecteur des Backtests à la recherche des meilleurs paramètres
- Effectuer ensuite des backtests pour avoir les meilleurs paramètres

La démarche pas à pas version écrite

Programme réalisé dans la vidéo avant le Backtest ( en couleur les modifications adoptées)

Code : Tout sélectionner

 
//+------------------------------------------------------------------+
 //| This MQL is generated by Expert Advisor Builder |
 //| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
 //| |
 //| In no event will author be liable for any damages whatsoever. |
 //| Use at your own risk. |
 //| |
 //+------------------- DO NOT REMOVE THIS HEADER --------------------+
 
#define SIGNAL_NONE 0
 #define SIGNAL_BUY 1
 #define SIGNAL_SELL 2
 #define SIGNAL_CLOSEBUY 3
 #define SIGNAL_CLOSESELL 4
 
#property copyright "Expert Advisor Builder"
 #property link "http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/"
 
extern int MagicNumber = 0;
 extern bool SignalMail = False;
 extern bool EachTickMode = False;
 extern double Lots = 1.0;
 extern int Slippage = 3;
 extern bool UseStopLoss = False;
 extern int StopLoss = 30;
 extern bool UseTakeProfit = False;
 extern int TakeProfit = 60;
 extern bool UseTrailingStop = False;
 extern int TrailingStop = 30;
 
extern int MA14 = 14;
 extern int MA28 = 28 ;
 
int BarCount;
 int Current;
 bool TickCheck = False;
 //+------------------------------------------------------------------+
 //| expert initialization function |
 //+------------------------------------------------------------------+
 int init() {
 BarCount = Bars;
 
if (EachTickMode) Current = 0; else Current = 1;
 
return(0);
 }
 //+------------------------------------------------------------------+
 //| expert deinitialization function |
 //+------------------------------------------------------------------+
 int deinit() {
 return(0);
 }
 //+------------------------------------------------------------------+
 //| expert start function |
 //+------------------------------------------------------------------+
 int start() {
 int Order = SIGNAL_NONE;
 int Total, Ticket;
 double StopLossLevel, TakeProfitLevel;
 


if (EachTickMode && Bars != BarCount) TickCheck = False;
 Total = OrdersTotal();
 Order = SIGNAL_NONE;
 
//+------------------------------------------------------------------+
 //| Variable Begin |
 //+------------------------------------------------------------------+
 

double Buy1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double Buy1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double Buy2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 double Buy2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 
double Sell1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double Sell1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double Sell2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 double Sell2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 
double CloseBuy1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double CloseBuy1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double CloseBuy2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 double CloseBuy2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 
double CloseSell1_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double CloseSell1_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 0);
 double CloseSell2_1 = iMA(NULL, 0, MA14, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 double CloseSell2_2 = iMA(NULL, 0, MA28, 0, MODE_SMA, PRICE_CLOSE, Current + 1);
 

//+------------------------------------------------------------------+
 //| Variable End |
 //+------------------------------------------------------------------+
 
//Check position
 bool IsTrade = False;
 
for (int i = 0; i < Total; i ++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { IsTrade = True; if(OrderType() == OP_BUY) { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Buy) | //+------------------------------------------------------------------+ if (CloseBuy1_1 > CloseBuy1_2 && CloseBuy2_1 < CloseBuy2_2) Order = SIGNAL_CLOSEBUY; //+------------------------------------------------------------------+ //| Signal End(Exit Buy) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; } //Trailing stop if(UseTrailingStop && TrailingStop > 0) { 
if(Bid - OrderOpenPrice() > Point * TrailingStop) {
 if(OrderStopLoss() < Bid - Point * TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen); if (!EachTickMode) BarCount = Bars; continue; } } } } else { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Sell) | //+------------------------------------------------------------------+ if (CloseSell1_1 < CloseSell1_2 && CloseSell2_1 > CloseSell2_2) Order = SIGNAL_CLOSESELL;
 

//+------------------------------------------------------------------+
 //| Signal End(Exit Sell) |
 //+------------------------------------------------------------------+
 
if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
 OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange);
 if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell");
 if (!EachTickMode) BarCount = Bars;
 IsTrade = False;
 continue;
 }
 //Trailing stop
 if(UseTrailingStop && TrailingStop > 0) { 
if((OrderOpenPrice() - Ask) > (Point * TrailingStop)) {
 if((OrderStopLoss() > (Ask + Point * TrailingStop)) || (OrderStopLoss() == 0)) {
 OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, DarkOrange);
 if (!EachTickMode) BarCount = Bars;
 continue;
 }
 }
 }
 }
 }
 }
 
//+------------------------------------------------------------------+
 //| Signal Begin(Entry) |
 //+------------------------------------------------------------------+
 
if (Buy1_1 < Buy1_2 && Buy2_1 > Buy2_2) Order = SIGNAL_BUY;
 
if (Sell1_1 > Sell1_2 && Sell2_1 < Sell2_2) Order = SIGNAL_SELL; //+------------------------------------------------------------------+ //| Signal End | //+------------------------------------------------------------------+ //Buy if (Order == SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { if(!IsTrade) { //Check free margin if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; else StopLossLevel = 0.0; if (UseTakeProfit) TakeProfitLevel = Ask + TakeProfit * Point; else TakeProfitLevel = 0.0; Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue); if(Ticket > 0) {
 if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
 Print("BUY order opened : ", OrderOpenPrice());
 if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy");
 } else {
 Print("Error opening BUY order : ", GetLastError());
 }
 }
 if (EachTickMode) TickCheck = True;
 if (!EachTickMode) BarCount = Bars;
 return(0);
 }
 }
 
//Sell
 if (Order == SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) {
 if(!IsTrade) {
 //Check free margin
 if (AccountFreeMargin() < (1000 * Lots)) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return(0); } if (UseStopLoss) StopLossLevel = Bid + StopLoss * Point; else StopLossLevel = 0.0; if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; else TakeProfitLevel = 0.0; Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink); if(Ticket > 0) {
 if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) {
 Print("SELL order opened : ", OrderOpenPrice());
 if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell");
 } else {
 Print("Error opening SELL order : ", GetLastError());
 }
 }
 if (EachTickMode) TickCheck = True;
 if (!EachTickMode) BarCount = Bars;
 return(0);
 }
 }
 
if (!EachTickMode) BarCount = Bars;
 
return(0);
 }
 //+------------------------------------------------------------------+
 
Image
Attention de ne pas se tromper dans le programme certains robots sont nettement moins efficaces pour le trading automatisé !

stephane2.0
Membre assidu
Messages : 332
Inscription : 10 oct. 2011, 21:51

Re: Robot video explicative - realisation d'un programme

#3 Message par stephane2.0 »

Salut,

J'ai voulu tester mais l'EA doit avoir un bogue car il est grisé.

Répondre