Download MetaTrader 5
To add comments, please log in or register
How to buy a product in MetaTrader AppStore? Read the article!
marsoin06
20
marsoin06 2012.06.23 16:46 

bonjour,

je m'excuse de ne pas ecrire en anglais

je cherche a traduire un indicator de MT4 "  

Files:
marsoin06
20
marsoin06 2012.06.23 16:47  

je vous remercie de m'aider

voici la page codé:

 //+------------------------------------------------------------------+
//|                                                         OsMA.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright © 2004, MetaQuotes Software Corp."
#property  link      "http://www.metaquotes.net/"
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 4
#property  indicator_color1  LimeGreen
#property  indicator_color2  Green
#property  indicator_color3  Red
#property  indicator_color4  Maroon

//#property  indicator_level1  0.0003
//#property  indicator_level2  -0.0003

//---- indicator buffers
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;

double     ind_buffer1[], ind_buffer1s[];
double     ind_buffer2[], ind_buffer2s[];
double     ind_buffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 1 additional buffer used for counting.
   IndicatorBuffers(5);
   //---- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,4);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,4);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   SetIndexDrawBegin(0,34);
   SetIndexDrawBegin(1,34);
   SetIndexDrawBegin(3,34);
   SetIndexDrawBegin(4,34);
//---- 3 indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) &&
      !SetIndexBuffer(1,ind_buffer1s) &&
      !SetIndexBuffer(2,ind_buffer2) &&
      !SetIndexBuffer(3,ind_buffer2s) &&
      !SetIndexBuffer(4,ind_buffer3))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("OsMA("+FastEMA+","+SlowEMA+","+SignalSMA+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Awesome Oscillator                                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- check for possible errors
   if(counted_bars<0) return(-1);
   //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
   for(int i=0; i<limit; i++)
      ind_buffer3[i]=iOsMA(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_WEIGHTED,i);
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ind_buffer3[i];
      prev=ind_buffer3[i+1];
      if (((current<0)&&(prev>0))||(current<0))   up= false;   
      if (((current>0)&&(prev<0))||(current>0))   up= true;     
     
      if(!up)
        {
         if(current > prev)
           {
            ind_buffer2s[i]=current;
            ind_buffer2[i]=0.0;
            ind_buffer1[i]=0.0;
            ind_buffer1s[i]=0.0;            
           }       
         else
           {
            ind_buffer2[i]=current;
            ind_buffer2s[i]=0.0;
            ind_buffer1[i]=0.0;
            ind_buffer1s[i]=0.0;           
           }            
        }
        else
        {
         if(current < prev)
           {
            ind_buffer1s[i]=current;
            ind_buffer1[i]=0.0;
            ind_buffer2[i]=0.0;
            ind_buffer2s[i]=0.0;
           }
        else
           {
            ind_buffer1[i]=current;
            ind_buffer1s[i]=0.0;
            ind_buffer2[i]=0.0;
            ind_buffer2s[i]=0.0;
            }          
         }      
     }
//---- done
   return(0);
  }

TeamWox Groupware / MetaQuotes Software Corp.
  • www.metaquotes.net
The TeamWox Groupware helps to establish efficient cooperation within a company, increase efficiency of employees and cut expenses of an organization.
marsoin06
20
marsoin06 2012.06.23 16:49  

comment faire pour qu'il marche sur MT5

j'ai essayé avec le convertisseur mais ca ne marche pas

je vous remercie beaucoup 

onewithzachy
2271
onewithzachy 2012.06.24 03:40  

Bonjour marsoin06,

1 Would you please translate French to English, using Google Translate (Souhaitez-vous s'il vous plaît traduire du français vers l'anglais, en utilisant Google Translate) .

That way, many member will understand what is in discussion and willing to help you. (De cette façon, de nombreux États membres comprendront ce qui est en discussion et prêt à vous aider). 

2. Would you use SRC button when posting your codes (Souhaitez-vous utiliser le bouton SRC lors de la publication de vos codes) .

 

3.  Would you please search the website before asking. Click here. (Souhaitez-vous s'il vous plaît recherche sur le site avant de demander. Cliquez ici.)

4. Thank you very much for your understanding. (Merci beaucoup pour votre compréhension.)

:D 

Google Translate
  • translate.google.com
Google's free online language translation service instantly translates text and web pages. This translator supports: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Khmer, Korean, Lao, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Maori, Marathi, Mongolian, Nepali, Norwegian, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian, Slovak, Slovenian, Somali, Spanish, Swahili, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish, Yoruba, Zulu
marsoin06
20
marsoin06 2012.06.24 12:57  

Hello, I am sorry to have misused the forum I am looking for a convert this indicator for MT4 to MT5 I not successful has me converter servire whatever one can he convertire this indicator to MT5 thank you much here is the file:

 

 

 

Files:
onewithzachy
2271
onewithzachy 2012.06.24 16:17  

I look into the MQL4 codes. so, here's the Q

What is the chance of this programmer, who wrote this code below, to change his/her code ...

current = ind_buffer3[i];
prev    = ind_buffer3[i+1];
if (((current<0)&&(prev>0))||(current < 0))   up= false;    
if (((current>0)&&(prev<0)) || (current > 0))   up= true;

... into this one ???.

current = ind_buffer3[i];
prev    = ind_buffer3[i+1];
if (current < 0)   up = false;    
if (current > 0)   up = true;

 

onewithzachy
2271
onewithzachy 2012.06.24 16:55  
marsoin06:

Hello, I am sorry to have misused the forum I am looking for a convert this indicator for MT4 to MT5 I not successful has me converter servire whatever one can he convertire this indicator to MT5 thank you much here is the file:

Hi masoin06,

Since we all learning here, you should not ask for something for free. So here, I give you some direction on how to do it yourself. 

Please copy and paste a code from here (click here) to your MetaEditor, and change this following codes.

Everytime you copy paste, click Compile (F7). 

Because today is Sunday, I don't know if this running well on trading days.

Google translate 

(Bonjour marsoin06,

Puisque nous avons tous l'apprentissage ici, vous ne devriez pas demander quelque chose gratuitement. Donc, ici, je vous donne une certaine orientation sur la façon de faire vous-même.

S'il vous plaît copiez et collez un code à partir d'ici (cliquez ici) à votre MetaEditor, et de modifier ces codes suivants.

Chaque fois que vous copier coller, cliquez sur Compiler (F7). 

Parce que, aujourd'hui, c'est dimanche, je ne sais pas si cela fonctionne bien sur jours de bourse).

/*
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
//--- the iOsMA plot
#property indicator_label1  "iOsMA"
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrSilver
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
*/ 

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   1
//--- the iOsMA plot
#property indicator_label1  "iOsMA"
#property indicator_type1   DRAW_COLOR_HISTOGRAM
#property indicator_color1  clrMaroon,clrRed,clrGreen,clrLimeGreen
#property indicator_style1  STYLE_SOLID
#property indicator_width1  5

 

/*
input int                  signal_period=9;           // period of averaging of difference
input ENUM_APPLIED_PRICE   applied_price=PRICE_CLOSE; // type of price  
input string               symbol=" ";                // symbol 
input ENUM_TIMEFRAMES      period=PERIOD_CURRENT;     // timeframe
//--- indicator buffer
double         iOsMABuffer[];
//--- variable for storing the handle of the iAMA indicator
int    handle;
*/
input int                  signal_period=9;           // period of averaging of difference
input ENUM_APPLIED_PRICE   applied_price=PRICE_WEIGHTED; // type of price  
input string               symbol=" ";                // symbol 
input ENUM_TIMEFRAMES      period=PERIOD_CURRENT;     // timeframe
//--- indicator buffer
double         iOsMABuffer[];
//--- color buffer
double         Color_Buffer[];
//--- variable for storing the handle of the iAMA indicator
int    handle;

 

/*
//--- assignment of array to indicator buffer
SetIndexBuffer(0,iOsMABuffer,INDICATOR_DATA);
*/
//--- assignment of array to indicator buffer
SetIndexBuffer(0,iOsMABuffer,INDICATOR_DATA);
SetIndexBuffer(1,Color_Buffer,INDICATOR_COLOR_INDEX);

 

/*    
//--- fill the arrays with values of the iOsMA indicator
//--- if FillArrayFromBuffer returns false, it means the information is nor ready yet, quit operation
   if(!FillArrayFromBuffer(iOsMABuffer,handle,values_to_copy)) return(0);
//--- form the message
   string comm=StringFormat("%s ==>  Updated value in the indicator %s: %d",
                            TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS),
                            short_name,
                            values_to_copy);

*/ 
//--- fill the arrays with values of the iOsMA indicator
//--- if FillArrayFromBuffer returns false, it means the information is nor ready yet, quit operation
   if(!FillArrayFromBuffer(iOsMABuffer,handle,values_to_copy)) return(0);
//--- change the color
   bool up = true;
   double current = 0.0, prev = 0.0;
   for(int i= rates_total - prev_calculated - 2; i>= 0; i--)
     {
     
      current = iOsMABuffer[i];
      prev    = iOsMABuffer[i+1];
      if (current < 0)   up = false;    
      if (current > 0)   up = true; 
      if(!up)
        {
         if(current > prev)
           {
            Color_Buffer [i] = 0;             
           }        
         else
           {
            Color_Buffer [i] = 1;           
           }             
        }
        else
        {
         if(current < prev)
           {
            Color_Buffer [i] = 2;
           }
        else
           {
            Color_Buffer [i] = 3;
           }           
         } 
     }                           
//--- form the message
   string comm=StringFormat("%s ==>  Updated value in the indicator %s: %d",
                            TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS),
                            short_name,
                            values_to_copy);


Google Translate
  • translate.google.com
Google's free online language translation service instantly translates text and web pages. This translator supports: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bengali, Bosnian, Bulgarian, Catalan, Cebuano, Chinese, Croatian, Czech, Danish, Dutch, Esperanto, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Gujarati, Haitian Creole, Hausa, Hebrew, Hindi, Hmong, Hungarian, Icelandic, Igbo, Indonesian, Irish, Italian, Japanese, Javanese, Kannada, Khmer, Korean, Lao, Latin, Latvian, Lithuanian, Macedonian, Malay, Maltese, Maori, Marathi, Mongolian, Nepali, Norwegian, Persian, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian, Slovak, Slovenian, Somali, Spanish, Swahili, Swedish, Tamil, Telugu, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish, Yoruba, Zulu
marsoin06
20
marsoin06 2012.06.24 19:22  

Hello thank you very much Onewithzachy

I have many problem to understand MQ5 and I thought be a forum of support and even with the Google Translator it is not win

I'll try to install your codes and thank you very much of answering me

I present you the flag in MT4 that I have in MT5 because in MT5 there with a single color cordially

Files:
Capture.PNG 265 kb
onewithzachy
2271
onewithzachy 2012.06.25 03:57  
marsoin06:

Hello thank you very much Onewithzachy

I have many problem to understand MQ5 and I thought be a forum of support and even with the Google Translator it is not win

I'll try to install your codes and thank you very much of answering me

I present you the flag in MT4 that I have in MT5 because in MT5 there with a single color cordially

Hi marsoin06,

Looks like we have a problem, the color does not change correctly. I'll have take a look at it later - hopes other forumers help - there's not much help around here.

I hope you patient with it.

:D 


 [EDIT : I add a little print to check buffer value but I don't understand the result. The value is undefined after loop 33, see pics below. I'm running MT5 655 on Vista HB 32 bit, the .ex5 is attached. :( ]

           else
           {
            Color_Buffer [i] = 2;
           }           
         } 
      //if (i == 0)
      //  {
        Print("Value ",DoubleToString(iOsMABuffer[i], Digits())," | ",DoubleToString(iOsMABuffer[i+ 1], Digits()));
        Print("Loop ",i," | ", up," | ",values_to_copy," |rates ",rates_total," |prev ",prev_calculated," | ",Color_Buffer [i]);
      //  }
      
     }                           
//--- form the message

 

Files:
onewithzachy
2271
onewithzachy 2012.07.23 10:41  
onewithzachy:

Hi marsoin06,

Looks like we have a problem, the color does not change correctly. I'll have take a look at it later - hopes other forumers help - there's not much help around here.

I hope you patient with it.

:D 


 [EDIT : I add a little print to check buffer value but I don't understand the result. The value is undefined after loop 33, see pics below. I'm running MT5 655 on Vista HB 32 bit, the .ex5 is attached. :( ]

Hi,

I made a mistake a month ago - a visible mistake that everyone can see. Amazingly, no one correct that mistake or correct me.

I think this is the correct one.

   for(int i = prev_calculated -1; i < rates_total; i++)
     {
     // clrMaroon,clrRed,clrGreen,clrLimeGreen
      if (i <= 0)continue;
      current = iOsMABuffer[i];
      prev    = iOsMABuffer[i-1];
      if (current < 0)   up = false;    
      if (current > 0)   up = true; 
      
      if(!up)
        {
         if(current > prev)
           {
            Color_Buffer [i] = 1;            
           }        
         else
           {
            Color_Buffer [i] = 0;           
           }             
        }
        else
        {
         if(current < prev)
           {
            Color_Buffer [i] = 3;
           }
        else
           {
            Color_Buffer [i] = 2;
           }           
         }
     } 
//--- form the message

:D

/
To add comments, please log in or register