Bonjour,
J'ai essayer en vain de modifier un indicateur car je suis une vraie bille en programmation.
En fait je voulais me créer un indicateur avec 2 conditions.
Signal sonore et visuel : -si croisement ema5 et ema10 (à la hausse ou à la baisse)
-et écart entre ema5 et ema10 > 35 points (0,00035) au niveau du 5ème chandelier qui précède le croisement.
Voir ma pièce jointe pour mieux comprendre.
Voilà, donc si vous pouvez m'aider pour savoir ce que je dois modifier ou ajouter, je suis preneur et je vous en remercie.
J'ai essayer de modifier le fichier suivant mais sans succès :
//+------------------------------------------------------------------+
//| flo.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| MetaTrader 5 Trading Platform / MetaQuotes Software Corp. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
//+------------------------------------------------------------------+
//| croisement de moyenne mobile.mq4 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Croisement moyenne mobile.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int fastperiod=10;
extern int slowperiod=5;
extern bool EnableAlert=true;
//---- buffers
double val1[];
double val2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,234);
SetIndexBuffer(0,val1);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,233);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| ema cross |
//+------------------------------------------------------------------+
int start()
{
int i,shift,counted_bars=IndicatorCounted();
double fastEma, slowEma,fastEmaPrev, slowEmaPrev;
bool IsLong=false;
bool IsShort=false;
int tendance;
for (shift = counted_bars; shift>=0; shift--)
{
fastEma = iMA(NULL,0,fastperiod,0,MODE_EMA,PRICE_CLOSE,shift );
slowEma = iMA(NULL,0,slowperiod,0,MODE_EMA,PRICE_CLOSE,shift );
fastEmaPrev = iMA(NULL,0,fastperiod,0,MODE_EMA,PRICE_CLOSE,shift +1);
slowEmaPrev = iMA(NULL,0,slowperiod,0,MODE_EMA,PRICE_CLOSE,shift +1);
val1[shift]=0;
val2[shift]=0;
if ((fastEma>slowEma)&&(fastEmaPrev<slowEmaPrev))
{
val1[shift]=0;
val2[shift]=Low[shift]-1*Point;
if ((EnableAlert)&&(shift==0))
{
Alert("Hausse ",Period()," ",Symbol());
}
}
if ((fastEma<slowEma)&&(fastEmaPrev>slowEmaPrev))
{
val1[shift]=High[shift]+1*Point;
val2[shift]=0;
if ((EnableAlert)&&(shift==0))
{
Alert("Baisse ",Period()," ",Symbol());
}
}
}
return(0);
}
//+------------------------------------------------------------------+
![]() |
|


LinkBack URL
About LinkBacks
Répondre avec citation