MEME SUJET

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

Modérateur : Administrateurs

Message
Auteur
Rmarc972
Membre actif
Messages : 10
Inscription : 03 oct. 2012, 15:38

MEME SUJET

#1 Message par Rmarc972 »

EA TREND SIGNAL.mq4
(2.72 Kio) Téléchargé 313 fois
EA

anthony
Membre actif et régulier
Messages : 53
Inscription : 10 août 2012, 23:08

Re: MEME SUJET

#2 Message par anthony »

Tien ;)

//+------------------------------------------------------------------+
//| EA TREND SIGNAL.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Igateway.mq4 |
//| Copyright © 2011, Nicolas Tuffier |
//| http://www.furyweb.fr/forex/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Nicolas Tuffier"
#property link "http://www.furyweb.fr/forex/"

//--- input parameters
extern string tradeComment="Gateway Managed";
extern double lotSize=0.01;
extern int slippage=2;
string clsVar="TrendSignal";
string opnVar="TrendSignal";

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() {
//----
opnVar=StringConcatenate("SignalOpen", Symbol(), Period());
clsVar=StringConcatenate("SignalClose", Symbol(), Period());

return(0);
}

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start() {
//----
int op;
double price;
color col;

if (GlobalVariableCheck(opnVar)) {
op = GlobalVariableGet(opnVar);
GlobalVariableDel(opnVar);
if (op == OP_BUY) {
col = Lime;
price = Ask;
}
if (op == OP_BUY) {
col = Red;
price = Bid;
}
OrderSend(Symbol(), op, lotSize, price, slippage, 0, 0, tradeComment, 0, 0, col);
}

if (GlobalVariableCheck(clsVar)) {
op = GlobalVariableGet(clsVar);
GlobalVariableDel(clsVar);
if (op == OP_BUY) {
col = Lime;
price = Bid;
} else {
col = Red;
price = Ask;
}
int n = OrdersTotal();
for (int i = 0; i < n; i++)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if (OrderType() == op && OrderComment() == tradeComment)

OrderClose(OrderTicket(), OrderLots(), price, slippage, col);

}

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

//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
//----

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

Répondre