Mon compte
Déjà membre ? S'identifier
Non inscrit ? S'inscrire
 
+ Répondre à la discussion
Affichage des résultats 1 à 4 sur 4
  1. #1
    Nouveau membre flodoom est sur la route de la réputation...
    Date d'inscription
    August 2011
    Messages
    8
    Pouvoir de réputation
    2

    Modification d'un indicateur Modification d'un indicateur

    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);
    }

    //+------------------------------------------------------------------+
    Images attachées

  2. #2
    Membre Performance jeanjo est sur la route de la réputation...
    Date d'inscription
    November 2010
    Messages
    181
    Pouvoir de réputation
    3

    Voilà un programme qui affiche les MA et les fleches, il faut peut-être modifier le Alert en bas

    #property indicator_chart_window
    #property indicator_buffers 4
    #property indicator_color1 LightSalmon
    #property indicator_color2 Aqua
    #property indicator_color3 Yellow
    #property indicator_color4 Lime

    //---- input parameters
    extern int fastperiod=10;
    extern int slowperiod=5;
    extern bool EnableAlert=true;

    //---- buffers
    double MA_courte[];
    double MA_longue[];
    double fleche_baisse[];
    double fleche_hausse[];

    //+------------------------------------------------------------------+
    //| Custom indicator initialization function |
    //+------------------------------------------------------------------+
    int init()
    {
    //---- indicator line
    IndicatorBuffers(4);

    SetIndexBuffer(0,MA_courte);
    SetIndexStyle(0,DRAW_LINE, STYLE_SOLID,2);

    SetIndexBuffer(1,MA_longue);
    SetIndexStyle(1,DRAW_LINE, STYLE_SOLID,2);


    SetIndexBuffer(2,fleche_hausse);
    SetIndexStyle(2,DRAW_ARROW);
    SetIndexArrow(2,234);
    SetIndexEmptyValue(2,0.0);

    SetIndexBuffer(3,fleche_baisse);
    SetIndexStyle(3,DRAW_ARROW);
    SetIndexArrow(3,233);
    SetIndexEmptyValue(3,0.0);

    return(0);
    }
    //+-------
    //+------------------------------------------------------------------+
    //| ema cross |
    //+------------------------------------------------------------------+
    int start()
    {
    int i,counted_bars=IndicatorCounted();
    double fastEma, slowEma,fastEmaPrev, slowEmaPrev;
    bool IsLong=false;
    bool IsShort=false;
    int tendance;

    int limit;
    //---- last counted bar will be recounted
    if(counted_bars>0) counted_bars--;
    limit=Bars-counted_bars;

    for( i=0; i<limit; i++)
    {
    MA_courte[i] = iMA(NULL,0,fastperiod,0,MODE_EMA,PRICE_CLOSE,i );
    MA_longue[i] = iMA(NULL,0,slowperiod,0,MODE_EMA,PRICE_CLOSE,i );

    MA_courte[i+1] = iMA(NULL,0,fastperiod,0,MODE_EMA,PRICE_CLOSE,i +1);
    MA_longue[i+1] = iMA(NULL,0,slowperiod,0,MODE_EMA,PRICE_CLOSE,i +1);

    if(MA_courte[i] > MA_longue[i] && MA_courte[i+1] < MA_longue[i+1])
    fleche_hausse[i] = High[i] + 10*Point;
    else fleche_hausse[i] = 0.0;

    if(MA_courte[i] < MA_longue[i] && MA_courte[i+1] > MA_longue[i+1])
    fleche_baisse[i] = Low[i] - 10*Point;
    else fleche_baisse[i] = 0.0;

    if( EnableAlert == true)
    {

    if(MathAbs(MA_courte[0] - MA_longue[0])/Point > 35*Point) Alert("bipbip");
    }


    double ecart_MA = MathAbs(MA_courte[0] - MA_longue[0])/Point ;
    string Diff = DoubleToStr(ecart_MA, 0);

    ObjectDelete("eee"+10);
    ObjectCreate ("eee"+10, OBJ_LABEL,0,0,0);
    ObjectSet("eee"+10, OBJPROP_CORNER,1);
    ObjectSet("eee"+10, OBJPROP_XDISTANCE,10);
    ObjectSet("eee"+10, OBJPROP_YDISTANCE,32);
    ObjectSetText("eee"+10, "Ecart_MA = " + Diff, 8, "Arial Black",Yellow);
    ObjectSet("eee"+10, OBJPROP_COLOR,Yellow);
    ObjectsRedraw();



    }
    return(0);

    }
    //+------------------------------------------------------------------+

  3. #3
    Membre Performance jeanjo est sur la route de la réputation...
    Date d'inscription
    November 2010
    Messages
    181
    Pouvoir de réputation
    3

    Ha oui, pour l''alerte il faudra ajouter boucle,

    if( croisement à 0 && MathAbs(MA_courte[5] - MA_longue(5])/Points > 35*Point) Alert (..........)

  4. #4
    Nouveau membre flodoom est sur la route de la réputation...
    Date d'inscription
    August 2011
    Messages
    8
    Pouvoir de réputation
    2

    Merci pour la réponse.
    Je vais essayer tout ça.
    Sympa

Discussions similaires

  1. modification indicateur ?
    Par didger dans le forum Trading Divers
    Réponses: 6
    Dernier message: 14/06/2011, 09h48
  2. besoin aide modification indicateur
    Par lmtrader dans le forum Programmation
    Réponses: 1
    Dernier message: 06/05/2011, 19h05
  3. Modification sur AE
    Par didger dans le forum Programmation
    Réponses: 0
    Dernier message: 06/02/2010, 22h48
  4. De l'aide pour modification indicateur
    Par vamm972 dans le forum Programmation
    Réponses: 4
    Dernier message: 01/12/2009, 17h12
  5. Modification d'un indicateur donnant S/R
    Par Moebus dans le forum Programmation
    Réponses: 15
    Dernier message: 31/10/2009, 22h49

Ajouter aux Favoris | Plan du site | Archives | Forex | Contact