Bon alors ce vieux machin (désolé

Typiquement je voudrais afficher -1.02% par rapport à une valeur X et non 9655 pour le DAX.
Merci.
Code : #
//+------------------------------------------------------------------+
//| cours en pourcentage.mq4 |
//| Copyright 2014, kim47.
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, kim47"
#property link "http://www.mql5.com"
#property version "1.00"
#property strict
#define NL "\n" //commentaire
extern double opendax30=-1;
extern double opencac40=-1;
extern double openeurusd=-1;
extern double openxauusd=-1;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//cours actuel
double dax30=MarketInfo("#FDXZ4",MODE_BID); // attention ,symbol cfd à risque limité et futur sont differents...
double cac40 = MarketInfo("#FCEZ4",MODE_BID);
double eurusd = MarketInfo("EURUSD",MODE_BID);
double xauusd = MarketInfo("GOLD",MODE_BID);
//si l'eimpreinte n'est pas rélevée une alerte est lancé pour le rentrer manuellement
if (opendax30 ||opencac40 ||openeurusd ||openxauusd<=0){
Alert("Empreinte impossible, veuillez entrer manuellement, merci!");
if (opendax30 &&opencac40 &&openeurusd &&openxauusd>0){
Alert("Empreinte enregistrées, merci!");
}}
//Empreinte selon horaire des marchés
if (Hour() == 0){ // forex
if (Minute() == 0){
if (Seconds() == 1){
openeurusd = Bid; openxauusd =Bid; }}}
if (Hour() == 9){ //indice
if (Minute() == 0){
if (Seconds() == 1){
opendax30 = Bid ; opencac40 = Bid; }}}
//calcul
dax30= (100 / opendax30 * dax30 - 100); // Ta formule dax 30
cac40= (100 / opencac40 * cac40 - 100); // Ta formule cac40
eurusd= (100 / openeurusd * eurusd - 100); // Ta formule eurusd
xauusd= (100 / openxauusd * xauusd - 100); // Ta formule pour l'or
//AFFICHAGE
Comment("DAX30 = ",(DoubleToStr(dax30,2))," %"+NL+ //affichage à 2 chiffre après la virgule
"CAC40 = ",(DoubleToStr(cac40,2))," %"+NL+
"EURUSD = ",(DoubleToStr(eurusd,2))," %"+NL+
"XAUUSD = ", (DoubleToStr(xauusd,2))," %"+NL);
// le graphe doit être impérativement ouvert avant l'ouverture sinon il ne récupère pas l'empreinte du premier mouvement....
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
Code : #
//+------------------------------------------------------------------+
//| cours en pourcentage.mq4 |
//| Copyright 2014, kim47.
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, kim47"
#property link "http://www.mql5.com"
#property version "1.1"
#property strict
#define NL "\n" //commentaire
// le graphe doit être impérativement ouvert avant l'ouverture sinon il ne récupère pas l'empreinte du premier mouvement....
extern double opendax30;
extern double opencac40;
extern double openeurusd;
extern double openxauusd;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//cours actuel
double dax30 = MarketInfo("#FDXZ4",MODE_BID); // attention ,symbol cfd à risque limité et futur sont differents...
double cac40 = MarketInfo("#FCEZ4",MODE_BID); // possibilité de changer les symboles a votre convenance
double eurusd = MarketInfo("EURUSD",MODE_BID);
double xauusd = MarketInfo("GOLD",MODE_BID); // exemple GOLD par XAUUSD (ou autre) mais il va falloir modifier l'affichage aussi dans la partie 'comment' !!!
// pour backtest seulement !!! à griser en mode "live"
//if ((dax30<=0)||(cac40<=0)||(eurusd<=0)||(xauusd<=0)){dax30=10000; cac40=5000; eurusd=1.50; /*xauusd= 2000;*/}
//si l'eimpreinte n'est pas rélevée une alerte est lancé pour l'entrer manuellement
if (opendax30 && opencac40 && openeurusd && openxauusd >0 ){
/* Alert("Empreintes enregistrées, merci!");*/
//calcul
double calc_dax30 = (100 / opendax30 * dax30 - 100); // Ta formule dax 30
double calc_cac40 = (100 / opencac40 * cac40 - 100); // Ta formule cac40
double calc_eurusd = (100 / openeurusd * eurusd - 100); // Ta formule eurusd
double calc_xauusd = (100 / openxauusd * xauusd - 100); // Ta formule pour l'or
//AFFICHAGE
Comment((DoubleToStr(Hour(),0))," H "+(DoubleToStr(Minute(),0))," min "+(DoubleToStr(Seconds(),0))," Sec"+ NL+
"DAX30 = ",(DoubleToStr(calc_dax30,2))," %"+" OPEN = ",(DoubleToStr(opendax30,2))+" DAX30 = ",(DoubleToStr(dax30,2))+NL+ //affichage à 2 chiffre après la virgule
"CAC40 = ",(DoubleToStr(calc_cac40,2))," %"+" OPEN = ",(DoubleToStr(opencac40,2))+" CAC40 = ",(DoubleToStr(cac40,2))+NL+
"EURUSD = ",(DoubleToStr(calc_eurusd,2))," %"+" OPEN = ",(DoubleToStr(openeurusd,5))+" EURUSD = ",(DoubleToStr(eurusd,5))+NL+
"XAUUSD = ", (DoubleToStr(calc_xauusd,2))," %"+" OPEN = ",(DoubleToStr(openxauusd,2))+" XAUUSD = ", (DoubleToStr(xauusd,2))+NL);
} else {
Comment("Empreinte impossible, veuillez entrer manuellement, merci !");
//pour bakctest seulement !!! à griser en mode "live"
/*opendax30=9845;
opencac40=4453;
openeurusd=1.29203;
openxauusd=1224;*/
}
//Empreinte selon horaires d'ouverture des marchés
if (Hour() == 0){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
openeurusd = eurusd;}}}
if (Hour() == 1){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
openxauusd = xauusd;}}}
if (Hour() == 9){ //indice
if (Minute() == 0){
if (Seconds() <=1){
opendax30 = dax30 ; opencac40 = cac40; }}} // cac trop court =problem
}
//+------------------------------------------------------------------+
Code : #
//+------------------------------------------------------------------+
//| cours en pourcentage.mq4 |
//| Copyright 2014, kim47.
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, kim47"
#property link "http://www.mql5.com"
#property version "1.2"
#property strict
#define NL "\n" //commentaire
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//cours actuel
double dax30 = MarketInfo("#FDXZ4",MODE_BID); // attention ,symbol cfd à risque limité et futur sont differents...
double cac40 = MarketInfo("#FCEZ4",MODE_BID); // possibilité de changer les symboles a votre convenance
double eurusd = MarketInfo("EURUSD",MODE_BID);
double xauusd = MarketInfo("GOLD",MODE_BID); // exemple GOLD par XAUUSD (ou autre) mais il va falloir modifier l'affichage aussi dans la partie 'comment' !!!
//Empreinte récupéré automatiquement (OPEN)
double opendax30 = iOpen("#FDXZ4",PERIOD_D1,0);
double opencac40 = iOpen("#FCEZ4",PERIOD_D1,0);
double openeurusd = iOpen("EURUSD",PERIOD_D1,0);
double openxauusd = iOpen("GOLD",PERIOD_D1,0);
// pour backtest seulement !!! à griser en mode "live"
//if ((dax30<=0)||(cac40<=0)||(eurusd<=0)||(xauusd<=0)){dax30=10000; cac40=5000; eurusd=1.50; /*xauusd= 2000;*/}
//si l'eimpreinte n'est pas rélevée une alerte est lancé pour modifier un ou plusieurs symbols
if (opendax30 && opencac40 && openeurusd && openxauusd >0 ){
/*Alert("Empreintes enregistrées, merci!");*/
//calcul
double calc_dax30 = (100 / opendax30 * dax30 - 100); // Ta formule dax 30
double calc_cac40 = (100 / opencac40 * cac40 - 100); // Ta formule cac40
double calc_eurusd = (100 / openeurusd * eurusd - 100); // Ta formule eurusd
double calc_xauusd = (100 / openxauusd * xauusd - 100); // Ta formule pour l'or
//AFFICHAGE
Comment((DoubleToStr(Hour(),0))," H "+(DoubleToStr(Minute(),0))," min "+(DoubleToStr(Seconds(),0))," Sec"+ NL+
"DAX30 = ",(DoubleToStr(calc_dax30,2))," %"+" OPEN = ",(DoubleToStr(opendax30,2))+" DAX30 = ",(DoubleToStr(dax30,2))+NL+ //affichage à 2 chiffre après la virgule
"CAC40 = ",(DoubleToStr(calc_cac40,2))," %"+" OPEN = ",(DoubleToStr(opencac40,2))+" CAC40 = ",(DoubleToStr(cac40,2))+NL+
"EURUSD = ",(DoubleToStr(calc_eurusd,2))," %"+" OPEN = ",(DoubleToStr(openeurusd,5))+" EURUSD = ",(DoubleToStr(eurusd,5))+NL+
"XAUUSD = ", (DoubleToStr(calc_xauusd,2))," %"+" OPEN = ",(DoubleToStr(openxauusd,2))+" XAUUSD = ", (DoubleToStr(xauusd,2))+NL);
} else {
Comment("Empreinte impossible, vérifiez les symbols , merci !");
//pour bakctest seulement !!! à griser en mode "live"
/*opendax30=9845;
opencac40=4453;
openeurusd=1.29203;
openxauusd=1224;*/
}
// horaires d'ouverture des marchés
/*if (Hour() == 0){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
}}}
if (Hour() == 1){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
}}}
if (Hour() == 9){ //indice
if (Minute() == 0){
if (Seconds() <=1){
}}} */
}
//+------------------------------------------------------------------+
Code : #
//+------------------------------------------------------------------+
//| cours en pourcentage.mq4 |
//| Copyright 2014, kim47.
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, kim47, update falex IG/FXCM"
#property link "http://www.mql5.com"
#property version "1.2"
#property strict
#define NL "\n" //commentaire
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
//cours actuel
double dax30 = MarketInfo("Dax 30",MODE_BID); // attention ,symbol cfd à risque limité et futur sont differents...
double cac40 = MarketInfo("FRA40",MODE_BID); // possibilité de changer les symboles a votre convenance
double eurusd = MarketInfo("EURUSD",MODE_BID);
double xauusd = MarketInfo("XAUUSD",MODE_BID); // exemple GOLD par XAUUSD (ou autre) mais il va falloir modifier l'affichage aussi dans la partie 'comment' !!!
//Empreinte récupéré automatiquement (OPEN)
double opendax30 = iOpen("Dax 30",PERIOD_D1,0);
double opencac40 = iOpen("FRA40",PERIOD_D1,0);
double openeurusd = iOpen("EURUSD",PERIOD_D1,0);
double openxauusd = iOpen("XAUUSD",PERIOD_D1,0);
// pour backtest seulement !!! à griser en mode "live"
//if ((dax30<=0)||(cac40<=0)||(eurusd<=0)||(xauusd<=0)){dax30=10000; cac40=5000; eurusd=1.50; /*xauusd= 2000;*/}
//si l'eimpreinte n'est pas rélevée une alerte est lancé pour modifier un ou plusieurs symbols
if (opendax30 && opencac40 && openeurusd && openxauusd >0 ){
/*Alert("Empreintes enregistrées, merci!");*/
//calcul
double calc_dax30 = (100 / opendax30 * dax30 - 100); // Ta formule dax 30
double calc_cac40 = (100 / opencac40 * cac40 - 100); // Ta formule cac40
double calc_eurusd = (100 / openeurusd * eurusd - 100); // Ta formule eurusd
double calc_xauusd = (100 / openxauusd * xauusd - 100); // Ta formule pour l'or
//AFFICHAGE
Comment((DoubleToStr(Hour(),0))," H "+(DoubleToStr(Minute(),0))," min "+(DoubleToStr(Seconds(),0))," Sec"+ NL+
"DAX30 = ",(DoubleToStr(calc_dax30,2))," %"+" OPEN = ",(DoubleToStr(opendax30,2))+" DAX30 = ",(DoubleToStr(dax30,2))+NL+ //affichage à 2 chiffre après la virgule
"CAC40 = ",(DoubleToStr(calc_cac40,2))," %"+" OPEN = ",(DoubleToStr(opencac40,2))+" CAC40 = ",(DoubleToStr(cac40,2))+NL+
"EURUSD = ",(DoubleToStr(calc_eurusd,2))," %"+" OPEN = ",(DoubleToStr(openeurusd,5))+" EURUSD = ",(DoubleToStr(eurusd,5))+NL+
"XAUUSD = ", (DoubleToStr(calc_xauusd,2))," %"+" OPEN = ",(DoubleToStr(openxauusd,2))+" XAUUSD = ", (DoubleToStr(xauusd,2))+NL);
} else {
Comment("Empreinte impossible, vérifiez les symbols , merci !");
//pour bakctest seulement !!! à griser en mode "live"
/*opendax30=9845;
opencac40=4453;
openeurusd=1.29203;
openxauusd=1224;*/
}
// horaires d'ouverture des marchés
/*if (Hour() == 0){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
}}}
if (Hour() == 1){ // forex
if (Minute() == 0){
if (Seconds() <= 1){
}}}
if (Hour() == 9){ //indice
if (Minute() == 0){
if (Seconds() <=1){
}}} */
}
//+------------------------------------------------------------------+