CAN I ASK SOME MT4 QUESTIONS ?

To add comments, please log in or register
monty1
59
monty1  

Hi,

 Can I ask some questions regarding MT4? i'm asking this because it's mql5 forum, but i can see mql4 questions here.  is it allowed?

Izzatilla Ikramov
10518
Izzatilla Ikramov  
monty1:

Hi,

 Can I ask some questions regarding MT4? i'm asking this because it's mql5 forum, but i can see mql4 questions here.  is it allowed?

Yes, it is allowed, you can ask any questions concerning MT4 and MT5
monty1
59
monty1  
izzatilla:
Yes, it is allowed, you can ask any questions concerning MT4 and MT5
Thank you Izzatilla.
hsaglam
7
hsaglam  
Example graph//---------------------------------------------------------------------------------------------------------------

#property indicator_chart_window    // Indicator is drawn in the main window

#property indicator_buffers 3       // Number of buffers

#property indicator_color1 Blue     // Color of the 1st line

#property indicator_color2 Red      // Color of the 2nd line

#property indicator_color3 Yellow   // Color of the 3th line

 

double Buf_0[],Buf_1[],Buf_2[];             // Declaring arrays (for indicator buffers)

//--------------------------------------------------------------------

int init()                                      // Special function init()

  {

   SetIndexBuffer(0,Buf_0);                     // Assigning an array to a buffer

   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,2);   // Line style



   SetIndexBuffer(1,Buf_1);                     // Assigning an array to a buffer

   SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,2);   // Line style



   SetIndexBuffer(2,Buf_2);                     // Assigning an array to a buffer

   SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,2);   // Line style

   return;                                      // Exit the special funct. init()

  }

//--------------------------------------------------------------------

int start()                         // Special function start()

  {

   int i,                           // Bar index

       Counted_bars;                // Number of counted bars

//--------------------------------------------------------------------

   Counted_bars=IndicatorCounted(); // Number of counted bars

   i=Bars-Counted_bars-1;           // Index of the first uncounted

   while(i>=0)                      // Loop for uncounted bars

     {

        Buf_0[i]=Close[i];

        Buf_1[i]=iMA(NULL,0,5,0,MODE_SMA,Buf_0[i],i);

        Buf_2[i]=iMA(NULL,0,5,0,MODE_SMA,Buf_1[i],i);

      i--;          

     }

//--------------------------------------------------------------------

   return;                          // Exit the special funct. start()

  }

//----------------------------------------------------------------------------------------------

Hi everybody.


I'm learnin new MT4 coding. But I know metastock very well.

I want to draw diffarent a moving average for examination and learning code writing menthality.


For example (Metastock version)

M1= Close;

M2=MOV(M1,5,S); // Simple 5 period moving average of M1

M3=MOV(M2,5,S); // Simple 5 period moving average of M2


I've wrote above code on MT4 but not working. How can i write this code on MT4 ?


Can anybody help me??


Thanks for your advice.

Sergey Golubev
Moderator
114214
Sergey Golubev  
William Roeder
20207
William Roeder  
  1. monty1 Can I ask some questions regarding MT4? i'm asking this because it's mql5 forum, but i can see mql4 questions here.  is it allowed? I've wrote above code on MT4 but not working
    Look at the URL of the up arrow it is https://www.mql5.com/en/forum/mql4 Which is the MQL4 section, (bottom of the Root page.) Either you posted in the correct location, or more likely a moderator has already moved it.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

    And edited hsaglam's broken code using SRC.

  2. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here and our crystal balls are cracked. You must provide information.

  3. Buf_1[i]=iMA(NULL,0,5,0,MODE_SMA,Buf_0[i],i);
    The second from the last argument must be ENUM_APPLIED_PRICE
              iMA - Technical Indicators - MQL4 Reference

    What you are trying to do, requires iMAOnArray

  4. int start()                         // Special function start()
    :
       Counted_bars=IndicatorCounted(); // Number of counted bars
    Start using the new Event Handling Functions.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference
              How to do your lookbacks correctly.
hsaglam
7
hsaglam  
whroeder1:
  1. Look at the URL of the up arrow it is https://www.mql5.com/en/forum/mql4 Which is the MQL4 section, (bottom of the Root page.) Either you posted in the correct location, or more likely a moderator has already moved it.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

    And edited hsaglam's broken code using SRC.

  2. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here and our crystal balls are cracked. You must provide information.

  3. The second from the last argument must be ENUM_APPLIED_PRICE
              iMA - Technical Indicators - MQL4 Reference

    What you are trying to do, requires iMAOnArray

  4. Start using the new Event Handling Functions.
              Event Handling Functions - Functions - Language Basics - MQL4 Reference
              How to do your lookbacks correctly.

Hi.

First my english is not good. I'm sorry for this.

And thanks for your helpfull advice.

I want to draw a moving average on chart window like above graphic.

I'll try loopbacks methods and iMAOnArray function. 

To add comments, please log in or register