Mon compte
Déjà membre ? S'identifier
Non inscrit ? S'inscrire
 
+ Répondre à la discussion
Affichage des résultats 1 à 2 sur 2
  1. #1
    Membre Performance TAAD est sur la route de la réputation...
    Date d'inscription
    June 2008
    Messages
    164
    Pouvoir de réputation
    6

    Besoin d'aide sur gestion de tableau Besoin d'aide sur gestion de tableau

    Bonjour à tous

    Je ne m'en sort pas avec la gestion de tableaux !

    J'ai lu la doc MQL4 mais rien n'y fait je n'arrive pas à transformer un indic en EA.

    Je souhaite m'exercer en transformant l'indic MACD en EA.
    L'EA ne prendrait pas de position pour l'instant mais afficherait via la fonction "comment" la valeur de macdbuffer[0], macdbuffer[1], SignalBuffer[0] et SignalBuffer[1]

    Si quelqu'un peut m'aider se serait super cool car je galère depuis un bon moment.

    Je pense que l'apprentissage par l'exemple est la seule solution pour que je comprenne enfin.

    Si vous avez dèjà fait cette opération sur d'autres indic gérant des tableaux je suis preneur.

    D'avance merci pour votre aide.

    TAAD

    Code:
    #property  copyright "Copyright © 2004, MetaQuotes Software Corp."
    #property  link      "http://www.metaquotes.net/"
    //---- indicator settings
    #property  indicator_separate_window
    #property  indicator_buffers 2
    #property  indicator_color1  Silver
    #property  indicator_color2  Red
    #property  indicator_width1  2
    //---- indicator parameters
    extern int FastEMA=12;
    extern int SlowEMA=26;
    extern int SignalSMA=9;
    //---- indicator buffers
    double     MacdBuffer[];
    double     SignalBuffer[];
    
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    //---- drawing settings
       SetIndexStyle(0,DRAW_HISTOGRAM);
       SetIndexStyle(1,DRAW_LINE);
       SetIndexDrawBegin(1,SignalSMA);
       IndicatorDigits(Digits+1);
    //---- indicator buffers mapping
       SetIndexBuffer(0,MacdBuffer);
       SetIndexBuffer(1,SignalBuffer);
    //---- name for DataWindow and indicator subwindow label
       IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
       SetIndexLabel(0,"MACD");
       SetIndexLabel(1,"Signal");
    //---- initialization done
       return(0);
      }
    //+------------------------------------------------------------------+
    //| Moving Averages Convergence/Divergence                           |
    //+------------------------------------------------------------------+
    int start()
      {
       int limit;
       int counted_bars=IndicatorCounted();
    //---- last counted bar will be recounted
       if(counted_bars>0) counted_bars--;
       limit=Bars-counted_bars;
    //---- macd counted in the 1-st buffer
       for(int i=0; i<limit; i++)
          MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
    //---- signal line counted in the 2-nd buffer
       for(i=0; i<limit; i++)
          SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
    //---- done
       return(0);
      }
    //+------------------------------------------------------------------+

  2. #2
    Membre lvl 5 aupa est sur la route de la réputation...
    Date d'inscription
    March 2010
    Messages
    7
    Pouvoir de réputation
    4

    Bonjour,

    Dans metatrader tu crés un ea. Dans celui-ci, il faut que tu fasse appelle à la fonction suivant :
    double iMACD( string symbol, int timeframe, int fast_ema_period, int slow_ema_period, int signal_period, int applied_price, int mode, int shift)

    Juste après le start, tu mets un truc du genre :
    Code:
    int start()
      {
    Comment(iMACD(...
    }
    Tu peux utiliser la fonction Print pour écrire dans le journal.

    Grace à la touche F1, tu peux avoir une aide sur la définition des fonctions et de leur paramètre.

Discussions similaires

  1. besoin d'aide
    Par sigmound dans le forum Novice sur le Forex
    Réponses: 3
    Dernier message: 22/02/2010, 23h02
  2. Besoin d'aide s-v-p...
    Par Satie dans le forum Systèmes de Trading Auto
    Réponses: 13
    Dernier message: 18/09/2009, 20h48
  3. besoin d'aide
    Par dida77 dans le forum Utilisation des Plateformes de Trading
    Réponses: 4
    Dernier message: 23/02/2009, 02h19
  4. besoin d'aide svp
    Par hedger dans le forum Systèmes de Trading Auto
    Réponses: 3
    Dernier message: 21/09/2008, 21h01
  5. Besoin d'aide
    Par Christophe-wilhelm dans le forum Novice sur le Forex
    Réponses: 1
    Dernier message: 06/09/2008, 14h17

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