1 10 123 ...
1 10 99

: MQL4

  1. #1
      kira-h
    Nov 2013
    6,242

    MQL4



    ( )
    google ( mql4)

    :



    + mql4 MetaTrader4

    + mql4 :
    - Expert Advisor : ݡ .
    - Indicator: .
    - Script: ɡ .

    mql4
    12349

    - Library: ̡ ʡ mql4 .
    - Include: .

    + :
    File-->Open Data Folder
    ѡ MQL4 :
    12350
    .

    + MetaEditor: ѡ
    Tools F4
    :
    - .
    - .
    - .
    - EX4 Compiler.
    - .

    + mql4 :

    - underscore ( ) { } /
    - (
    :
    * if else
    * while for
    * switch
    * Function()
    * Preprocessor #

    :
    PHP:
    #property copyright "Copyright  2015, by kira-h        
    OnTick()      
    NDigits
    =Digits
    --------------------------------------------------------------------------------------------------------------------------
    :

    MQL4 ѡ .

    + :

    PHP:
    int OnInit() 


    + :

    PHP:
    OnDeinit(const int reason


    + :

    PHP:
    OnTick() 




    :
    ʡ


    PHP:
    // 

    .
    PHP:
    /* 
    PHP:
    */ 
    :
    PHP:
    // My name is Hassan 

    PHP:
    /*My name is Hassan 
    thanks
    */ 
    MQL


    MQL

    :

    int

    :
    PHP:
    int Takeprofit=100

    double

    :
    PHP:
    double Lots=0.01

    string
    " "
    :
    PHP:
    string  MM_Parameters "---------- Money Management"

    bool
    (true) (false)
    :
    PHP:
    bool Use_HiddenTP=true

    ;
    mql4


    PHP:
    {

    Comment

    ( ) "" ( + ) ( , ) (
    :
    PHP:
    Comment("Programmed by Kira-h"+"\n"+"   "+"\n"+"http://www.forexprog.com/"); 



    double :
    PHP:
    double ma1;
     
    double ma2;
     
    double ma11;
     
    double ma22

    PHP:
    double ma1,
             
    ma2,
             
    ma11,
             
    ma22

    PHP:
    double ma1,ma2,ma11,ma22


    PHP:
    ma1=iMA(NULL,0,30,0,MODE_EMA,PRICE_CLOSE,1);
     
    ma11=iMA(NULL,0,30,0,MODE_EMA,PRICE_CLOSE,2);
     
    ma2=iMA(NULL,0,9,0,MODE_EMA,PRICE_CLOSE,1);
     
    ma22=iMA(NULL,0,9,0,MODE_EMA,PRICE_CLOSE,2); 



    12354


    PHP:
    iMAstring symbolint timeframeint periodint ma_shiftint ma_methodint applied_priceint shift) ; 

    iMA
    Moving Average
    symbol NULL
    timeframe
    period , ma_shift ,ma_method ,applied_price
    shift
    0 , 1 ,2 .

    4

    PHP:
       iADXstring symbolint timeframeint periodint applied_priceint modeint shift);
       
    iATRstring symbolint timeframeint periodint shift); 
       
    iBandsstring symbolint timeframeint periodint deviationint bands_shiftint applied_priceint modeint shift);
       
    iCCIstring symbolint timeframeint periodint applied_priceint shift); 
       
    iDeMarkerstring symbolint timeframeint periodint shift);
       
    iForcestring symbolint timeframeint periodint ma_methodint applied_priceint shift);  
       
    iIchimokustring symbolint timeframeint tenkan_senint kijun_senint senkou_span_bint modeint shift);
       
    iMomentumstring symbolint timeframeint periodint applied_priceint shift);
       
    iMAstring symbolint timeframeint periodint ma_shiftint ma_methodint applied_priceint shift);
       
    iOsMAstring symbolint timeframeint fast_ema_periodint slow_ema_periodint signal_periodint applied_priceint shift);
       
    iMACDstring symbolint timeframeint fast_ema_periodint slow_ema_periodint signal_periodint applied_priceint modeint shift);
       
    iSARstring symbolint timeframedouble stepdouble maximumint shift);
       
    iRSIstring symbolint timeframeint periodint applied_priceint shift);
       
    iStochasticstring symbolint timeframeint Kperiodint Dperiodint slowingint methodint price_fieldint modeint shift);
       
    iWPRstring symbolint timeframeint periodint shift); 
       
    iStdDevstring symbolint timeframeint ma_periodint ma_shiftint ma_methodint applied_priceint shift); 


    iCustom
    PHP:
    iCustomstring symbolint timeframestring name, ..., int modeint shift); 

    symbol NULL
    timeframe 0
    name ""

    mode
    shift

    ex4 Compile indicators



    12355


    PHP:
    ma1=iMA(NULL,0,30,0,MODE_EMA,PRICE_CLOSE,1);
     
    ma11=iMA(NULL,0,30,0,MODE_EMA,PRICE_CLOSE,2);
     
    ma2=iMA(NULL,0,9,0,MODE_EMA,PRICE_CLOSE,1);
     
    ma22=iMA(NULL,0,9,0,MODE_EMA,PRICE_CLOSE,2); 
    2 ma11 , ma22
    1 ma1 , ma2

    2 2 1 1



    MQL4

    1_ ( + )
    PHP:
    A=3+5
    A 3+5 8

    2_ ( - )
    PHP:
     C=20-5
    5 20 C C=15

    3_ ( * )
    PHP:
    A=2*3
    2 3 A

    4_ ( / )
    PHP:
    A=6/2
    6 2 A

    5_ ( ++ )
    PHP:
    i++ 
    1 i i=5 6

    6_ ( -- )
    PHP:
     i-- 
    1 i i=5 4

    7_ ( = )
    PHP:
     A 
    A 3

    MQL4

    1_ ( < )
    PHP:

    A 3

    2_ ( > )
    PHP:

    A 3

    3_ (=< )
    4_ (=> )
    5_ ( =! )
    6_ ( == )
    PHP:
    == 
    A 4
    ( = )

    MQL4

    1_ ( && )
    PHP:
     A && <
    A 3 B 7

    2_ ( || )
    PHP:
    || 
    A 3 B 7

    3_ ( ! )
    PHP:
    !(== 7
    A 7



    ( if )

    :
    PHP:
    if(------) 
         {--------;} 
    ( )
    { } ;

    A 80 :
    PHP:
     if( 80 )
        { 
    Alert(" A above 80 "); } 
    1 :
    { } :
    PHP:
     if( 80 )
        
    Alert(" A above 80 "); 
    2 :
    :
    PHP:
    if( 80 )
        { 
        
    Alert(" A above 80 ");
        
    PlaySound("Alert.wav");
        } 
    A 80 A 80 A 80
    if .....else

    if .....else
    A =50 A 50 A 50 if ....... else
    :
    PHP:
     if( A==50){
             Print(
    "A = 50");}
             else{
             Print(
    "A != 50");} 
    OrderSend
    :
    PHP:
    OrderSendstring symbolint cmddouble volumedouble priceint slippagedouble stoplossdouble takeprofitstring commentint magicdatetime expirationcolor arrow_color); 

    symbol
    cmd
    volume
    price Ask Bid

    slippage 3 90.15 3
    stoploss
    takeprofit
    comment
    magic
    expiration
    arrow_color



    : for
    for
    PHP:
    for(int i=5;i>0;i--)
     {
     
    PlaySound("Alert.wav");
     } 
    for i=5 i i i=4
    i>0 i
    i=0 i>0

    : while
    for :
    PHP:
    int i;
    while(
    i<20)
     {
     
    PlaySound("Alert.wav");i++
     } 
    i 20 i 20 i i

    1 :
    :
    PHP:
    for(int i=5;i>0;i--)
     {
     
    PlaySound("Alert.wav");
     Print(
    "ArabicTrader");
     } 
    2 :
    i :
    PHP:
    int i;
      for(
    i=0;i<20;i++)
     {
     
    PlaySound("Alert.wav");
     } 

    :
    PHP:
    for(int i=1;i<=10;i00)
     {
      if(
    i==4)break;
     } 
    break 0 11 :
    0 1 2 3 4 5 6 7 8 9 10 11
    i 4 :
    0 1 2 3 4

    :
    PHP:
    for(int i=1;i<=10;i00)
     {
      if(
    i==4)continue;
     } 
    continue
    :
    0 1 2 3 4 5 6 7 8 9 10 11
    continue 4 :
    0 1 2 3 5 6 7 8 9 10 11





    :
    PHP:
    OnInit()      OnTick()     OnDeinit(const int reason
    :
    PHP:
    int orderscnt(){
     
     
      return(
    0);
      } 

    int
    double
    bool
    ()
    { }
    return
    0


    PHP:
    int equal(){
    int a=5int b=12;

    int c=a+b;

    return(
    c);

    a 5 b 12
    c=a+b

    PHP:
    return(c); 
    OnTick 20

    OnTick
    PHP:
     if( equal() < 20 ){PlaySound("Alert.wav");} 
    equal 12+5

    12 5
    a b ( ) :
    PHP:
    int equal(int a int b){

    double c=a+b;

    return(
    c);

    OnTick
    :
    PHP:
    if(equal(125)<20){PlaySound("Alert.wav");} 
    12 5 a b 12 5

    Sleep

    PHP:
    Sleep() 
    5 :
    PHP:
    Sleep(5000
    5000 1000

    : Ask OnTick ء . .



    MQL4

    ѡ ǡ
    ߡ mql4 .
    ɡ .




    :








    kira-h ; 04-27-2015 10:50 PM




  2. #2
      kira-h
    Nov 2013
    6,242
    !!! !!!

    :
    mql4
        . 

:	1.png 
:	989 
:	28.8  
:	12357

    :

        . 

:	2.png 
:	976 
:	3.8  
:	12358

    :


        . 

:	3.png 
:	972 
:	4.3  
:	12359

    :

    :
        . 

:	4.gif 
:	975 
:	8.9  
:	12360












  3. #3

    Jun 2013
    6,214








    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------
    Forex
    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------


    ----------------------------------------------------------------------------


    ----------------------------------------------------------------------------
    24 3
    ----------------------------------------------------------------------------


  4. #4

    Feb 2014
    57











  5. #5

    Feb 2014
    57
    ..












  6. #6
      kira-h
    Nov 2013
    6,242








    OjbectCreate

    :
    PHP:
    ObjectCreatestring nameint typeint windowdatetime time1double price1datetime time2=0double price2=0
    name
    type
    OBJ_RECTANGLE OBJ_TREND


    OBJ_VLINE
    HLINE
    OBJ_TEXT
    ---
    window 0
    1 window=1


        . 

:	5.png 
:	979 
:	40.4  
:	12367

    time1
    price1
    time2
    price2


        . 

:	6.png 
:	974 
:	30.5  
:	12368
    time1 0


    ------------------------------------------------------------------------------------------------------------------

    ObjectCreate ObjectSet


    PHP:
    ObjectCreate(nameOBJ_RECTANGLE0iTime(Symbol(),1440,1),iHigh(Symbol(),1440,1),iTime(Symbol(),1440,0),iLow(Symbol(),1440,1)); 
    ObjectSet
    PHP:
    ObjectCreate(nameOBJ_RECTANGLE00,0,0,0); 

    PHP:
    ObjectSet(name,OBJPROP_TIME1,iTime(Symbol(),1440,1));
             
    ObjectSet(name,OBJPROP_PRICE1,iHigh(Symbol(),1440,1));
              
    ObjectSet(name,OBJPROP_TIME2,iTime(Symbol(),1440,0));
               
    ObjectSet(name,OBJPROP_PRICE2,iLow(Symbol(),1440,1)); 




    PHP:
    void drawshap(string name,color LineColor,double Price1,double Price2,datetime Time1,datetime Time2)
        {
         if(
    ObjectFind(name) == -1)
            {
             
    ObjectCreate(nameOBJ_RECTANGLE0Time1,Price1,Time2,Price2);
             
    ObjectSet(nameOBJPROP_COLORLineColor);
             
    ObjectSet(nameOBJPROP_STYLESTYLE_SOLID);
              
    ObjectSet(nameOBJPROP_WIDTH2);
               }
             else if(
    ObjectGet(name,OBJPROP_TIME1)!=Time1||ObjectGet(name,OBJPROP_PRICE1)!=Price1){
             
    ObjectDelete(name);
              }
             } 
            
     
    void drawTrend(string name,color LineColor,double Price1,double Price2,datetime Time1,datetime Time2,bool b)
        {
         if(
    ObjectFind(name) == -1)
            {
             
    ObjectCreate(nameOBJ_TREND0Time1,Price1,Time2,Price2);
             
    ObjectSet(nameOBJPROP_COLORLineColor);
             
    ObjectSet(nameOBJPROP_STYLESTYLE_SOLID);
              
    ObjectSet(nameOBJPROP_WIDTH2);
              
    ObjectSet(name,OBJPROP_RAY,b);
              }
               else if(
    ObjectGet(name,OBJPROP_TIME1)!=Time1||ObjectGet(name,OBJPROP_PRICE1)!=Price1){
             
    ObjectDelete(name);
             }
            } 

    price1
    price2
    time1
    time2


    PHP:
    double H,L,O,C;
       
    datetime T1,T2;
       for(
    int i=1;i<Days_History;i++){
       
    H=iHigh(Symbol(),1440,i);
       
    L=iLow(Symbol(),1440,i);
       
    T1=iTime(Symbol(),1440,i);
       
    T2=iTime(Symbol(),1440,i-1);
       
    O=iOpen(Symbol(),1440,i);
       
    C=iClose(Symbol(),1440,i);
       if(
    DrawBox)drawshap("Box"+i,BoxColor,H,L,T1,T2);
       if(
    DrawTrend)drawTrend("Trend"+i,TrendColor,O,C,T1,T2,Trend_Ray);
       } 












  7. #7
      kira-h
    Nov 2013
    6,242



    PHP:
    //+------------------------------------------------------------------+
    //|                                                EasyProfit-EA.mq4 |
    //|                                            hassan.mb@hotmail.com |
    //|                                                           kira-h |
    //+-------------------DO NOT REMOVE THIS HEADER----------------------+ 
    //

    PHP:
    #property copyright "Copyright  2015, Programmed by kira-h"
    #property link      "hassan.mb@hotmail.com" 



    :
    PHP:
    //+------------------------------------------------------------------+
    //|                     Exported variables                           |
    //+------------------------------------------------------------------+
    input int MagicNo=0;
     
    input double Takeprofit=40;
     
    input double Stoploss=20

    PHP:
    //+------------------------------------------------------------------+
    //|                     Exported variables                           |
    //+------------------------------------------------------------------+
    extern int MagicNo=0;
     
    extern double Takeprofit=40;
     
    extern double Stoploss=20
    input ( ) extern ( )



    input extern ʡ
    :
    PHP:
    //+------------------------------------------------------------------+
    //|                         Local variables                          |
    //+------------------------------------------------------------------+
    double PipValue=1
    int NDigits=4

    OnInit OnTick OnDeinit


    + 3 4 5

    :
    PHP:
    //+------------------------------------------------------------------+
    //|                         Local variables                          |
    //+------------------------------------------------------------------+
    double PipValue=1;
    int NDigits=4;  
    //+------------------------------------------------------------------+
    //|                          Expert init                             |
    //+------------------------------------------------------------------+
    int OnInit()
    {
     
    NDigits=Digits
     return(
    0);    
    }
    //+------------------------------------------------------------------+
    //|                           Expert start                           |
    //+------------------------------------------------------------------+
    void OnTick()
    {
     
    PipValue=1;
     if(
    NDigits==3||NDigits==5)PipValue=10

    + :
    OnTick
    :

    - :
    PHP:
    int Orderscnts()

     
    int cnt=0;for(int i=0;i<OrdersTotal();i++)    
     
    {
      if(
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES))        
      
    {
       if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo        
       
    {
        
    cnt++;     
       
    }
      }
     }
     return(
    cnt);          

    OrderType

    PHP:
    int Orderscnts()

     
    int cnt=0;for(int i=0;i<OrdersTotal();i++)
     {
      if(
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
       if(
    OrderType()==OP_BUY&&OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
       {
        
    cnt++;
       }
      }
     }
     return(
    cnt);


    :
    PHP:
    int Orderscnts(int type)

     
    int cnt=0;for(int i=0;i<OrdersTotal();i++)
     {
      if(
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
       if(
    OrderType()==type&&OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
       {
        
    cnt++;
       }
      }
     }
     return(
    cnt);

    1 //////
    :
    PHP:
    if(Orderscnts(OP_BUY)<1
    {
     
    //////      

    OP_BUY OP_SELL OP_SELLSTOP OP_SELLLIMIT OP_BUYLIMIT OP_BUYSTOP




    :
    PHP:
    OrderComment()=="Kira-h" 


    -
    PHP:
    double LastOpenPrice()
    {
     for(
    int i=OrdersTotal()-1;i>=0;i--)
     {
      
    bool s1=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       return(
    OrderOpenPrice));
      }
     }
     return(
    0);

    - :
    PHP:
    double LastOpenLots()
    {
     for(
    int i=OrdersTotal()-1;i>=0;i--)
     {
      
    bool s1=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       return(
    OrderLots));
      }
     }
     return(
    0);

    - :
    PHP:
    int LastOpenType()
    {
     for(
    int i=OrdersTotal()-1;i>=0;i--)
     {
      
    bool s1=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       return(
    OrderType));
      }
     }
     return(
    0);

    - :
    PHP:
    double Profit_USD() 
    {
     
    double profit;
     for (
    int i=0;i<OrdersTotal();i++) 
     {
      
    bool s=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       
    profit+=OrderProfit();
      }
     }
     return(
    profit);

    :
    - :
    PHP:
    double LastOrderLots()
    {
     for(
    int i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      
    bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      
    double lots=OrderLots();
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       return(
    lots);
      }
     }
     return(
    0);

    - :
    PHP:
    double LastOrderProfit()
    {
     for(
    int i=OrdersHistoryTotal()-1;i>=0;i--)
     {
      
    bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      
    double profit=OrderProfit();
      if(
    OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNo)
      {
       return(
    profit);
      }
     }
     return(
    0);

    OnTick









    kira-h ; 04-28-2015 03:38 PM




  8. #8

    Nov 2014
    241


    ,










  9. #9
      kira-h
    Nov 2013
    6,242




    OnTick

    PHP:
    void OnTick()
    {
     
    double TP,SL;
     
    SL=Ask-Stoploss*Point;
     if(
    Stoploss==0)SL=0;
     
    TP=Ask+Takeprofit*Point;
     if(
    Takeprofit==0)TP=0;
     
    bool ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,"Kira-h",MagicNo,0,Red);
        

    OnTick
    :
    PHP:
    void OnTick()
    {
     
    BuyOrder();
    }

    void BuyOrder()
    {
      
    double TP,SL;
      
    SL=Ask-Stoploss*Point;
      if(
    Stoploss==0)SL=0;
      
    TP=Ask+Takeprofit*Point;
      if(
    Takeprofit==0)TP=0;
      
    bool ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,"Kira-h",MagicNo,0,Blue);); }     



    OnTick void ( void )


    PHP:
     double TP,SL;
     
    SL=Ask-Stoploss*Point;
     if(
    Stoploss==0)SL=0;
     
    TP=Ask+Takeprofit*Point;
     if(
    Takeprofit==0)TP=0
    SL=Ask-Stoploss*Point;
    Ask
    Stoploss
    1.3077 20
    Point
    SL=1.3077-20*Point
    1.3057
    Takeprofit

    OrderSend
    PHP:
    bool ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,"Kira-h",MagicNo,0,Blue); 
    {

    OrderSend :
    PHP:
    OrderSendstring symbolint cmddouble volumedouble priceint slippagedouble stoplossdouble takeprofitstring commentint magicdatetime expirationcolor arrow_color); 

    symbol
    cmd
    volume
    price Ask Bid

    slippage 3 90.15 3
    stoploss
    takeprofit
    comment
    magic
    expiration
    arrow_color

    ----------

    PHP:
    void SellOrder()
    {
     
    double TP,SL;
     
    SL=Bid+Stoploss*Point;
     if(
    Stoploss==0)SL=0
     else 
    TP=Bid-Takeprofit*Point;
     if(
    Takeprofit==0)TP=0
     
    bool ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,"Kira-h",MagicNo,0,Red);

    start {
    PHP:
    void OnTick()
    {
     
    BuyOrder()
     
    SellOrder()

    ʡ











    kira-h ; 04-30-2015 04:38 PM




  10. #10

    Jun 2013
    6,214








    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------
    Forex
    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------

    ----------------------------------------------------------------------------


    ----------------------------------------------------------------------------


    ----------------------------------------------------------------------------
    24 3
    ----------------------------------------------------------------------------


1 10 123 ...