1. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

Tutorial Tanya jawab kursus : Cara Membuat EA/Expert Advisors

Discussion in 'Belajar MQL dari Nol' started by Joy EA, 08 Aug 2021.

  1. Joy EA

    Joy EA Administrator Moderator

    Equity
    Credit
    Ref Point
    Khusus tempat bertanya para peserta kursus
     
    • Like Like x 2
  2. Kristian

    Kristian Member Credit Hunter

    Equity
    Credit
    Ref Point
    Tugas Pak.

    PHP:
    //+------------------------------------------------------------------+
    //|                                             1. Pengenalan EA.mq4 |
    //|                        Copyright 2021, MetaQuotes Software Corp. |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2021, MetaQuotes Software Corp."
    #property link      "https://www.mql5.com"
    #property version   "1.00"
    #property strict

    //--- input parameters
    input string Komen "EA Super Profit";


    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //---
      
       
    int MinTakeProfit  500;
       
    int MaxStopLoss    200;
       
    double Lot         0.5;
       
    string notes       "EA Super Profit";
      
      
       
    string info StringConcatenate("\nAccount : ",string(AccountNumber())
                                        ,
    "\nNama : ",AccountInfoString(ACCOUNT_NAME)
                                        ,
    "\nBroker : ",AccountInfoString(ACCOUNT_COMPANY)
                                        ,
    "\nLeverage : 1:",AccountInfoInteger(ACCOUNT_LEVERAGE)
                                        ,
    "\nBalance : ",DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2)
                                        ,
    "\nEquity : ",DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY),2)
                                        ,
    "\nMargin : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN),2)
                                        ,
    "\nFree Margin : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_FREE),2)
                                        ,
    "\nMargin Level : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_LEVEL),2),"%"
                                        
    ,"\nBid : ",DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),Digits)
                                        ,
    "\nAsk : ",DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),Digits)
                                        ,
    "\nSpread : ",IntegerToString(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))
                                        ,
    "\nSymbol : ",_Symbol
                                        
    );
      
       
    Comment(info);
      
    //---
       
    return(INIT_SUCCEEDED);
      }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //---
      
      
    }
    //+------------------------------------------------------------------+
    //| Expert tick function                                             |
    //+------------------------------------------------------------------+
    void OnTick()
      {
    //---
      
      
    }
    //+------------------------------------------------------------------+
     
    • Like Like x 2
  3. Rafael Benny

    Rafael Benny New Member

    Equity
    Credit
    Ref Point
    Mau tanya Pak, saya menaruh 2 perintah Comment ( ) contoh:
    Comment("Test Satu");
    Comment("\nTes Dua");
    tapi yang tampil adalah yang terakhir saja yaitu Test Dua
    Apakah benar hanya perintah Comment( ) terakhir saja yang tampil?
    Bila demikian, artinya saya perlu menggabungkan kalimat terlebih dahulu, seperti:
    Comment("Test Satu"+"\nTes Dua");

    Terimakasih.
     
  4. SoeHoe

    SoeHoe Administrator Moderator

    Equity
    Credit
    Ref Point
    Kalau perintah Comment memang begitu.

    Kalau mau buat seperti yg ada dalam harapan mas maka perintahnya adalah ObjectCreate(...), itu pelajaran kedua nanti. Mungkin Jumat, atau minggu. dengan perintah ini maka kita bisa mengatur ukuran, nama font, warna, posisi, dll.
     
  5. Rafael Benny

    Rafael Benny New Member

    Equity
    Credit
    Ref Point
    Baik Pak, nanti saya coba mengulang kembali edukasi dari youtubenya Pak SoeHoe, agar nantinya lebih cepat memahami yg diajarkan di sessi berikutnya. Terimakasih.
     
  6. skylin3

    skylin3 New Member

    Equity
    Credit
    Ref Point
    Kumpul Tugas Dulu
     

    Attached Files:

  7. skylin3

    skylin3 New Member

    Equity
    Credit
    Ref Point
    Sebelumnya, sy terima kasih om Soehoe udah mau luangkan waktu untuk mengajar cara membuat EA dari dasar, apakah untuk pembelajaran online tnya jawab, selain melalui zoom n forum ini apakah ada spt group chat wa/tele? trims
     
    • Like Like x 1
  8. Purwoko Hari Saputra

    Purwoko Hari Saputra New Member

    Equity
    Credit
    Ref Point
    Mohon ijin mengumpulkan Latihan 1

    Meta Editor.jpg
    Meta Editor.jpg MT 4.jpg MT 4.jpg
     
    • Like Like x 1
  9. SoeHoe

    SoeHoe Administrator Moderator

    Equity
    Credit
    Ref Point
    Ini Tugas saya ya Pak
    Code:
    //+------------------------------------------------------------------+
    //|                                                    BelajarEA.mq4 |
    //|                        Copyright 2021, MetaQuotes Software Corp. |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2021, MetaQuotes Software Corp."
    #property link      "https://www.mql5.com"
    #property version   "1.00"
    #property strict
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //---
          string NamaEA      = "Belajar EA";
     
     
       
     
    //---
       return(INIT_SUCCEEDED);
      }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //---
       
      }
    //+------------------------------------------------------------------+
    //| Expert tick function                                             |
    //+------------------------------------------------------------------+
    void OnTick()
      {
    //---
       string info = StringConcatenate("\nNAMA : ",AccountInfoString(ACCOUNT_NAME)
                                        ,"\nACCOUNT : ",string(AccountNumber())
                                        ,"\nBROKER : ",AccountInfoString(ACCOUNT_COMPANY)
                                        ,"\nLEVERAGE : 1:",AccountInfoInteger(ACCOUNT_LEVERAGE)
                                        ,"\nBALANCE : ",DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2)
                                        ,"\nEQUITY : ",DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY),2)
                                        ,"\nMARGIN : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN),2)
                                        ,"\nFREE MARGIN : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_FREE),2)
                                        ,"\nMARGIN LEVEL : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_LEVEL),2),"%"
                                        ,"\nBID : ",DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),Digits)
                                        ,"\nASK : ",DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),Digits)
                                        ,"\nSPREAD : ",IntegerToString(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))
                                        ,"\nSYMBOL : ",_Symbol
                                        );
     
       Comment(info);
      }
    //+------------------------------------------------------------------+
    
     
    • Like Like x 1
  10. Threadmark: File Latihan 2
    SoeHoe

    SoeHoe Administrator Moderator

    Equity
    Credit
    Ref Point
    File Latihan Kelas pertama. Sebaiknya jangan copas, tapi tulis ulang ya. biar semakin terlatih
    Code:
    //+------------------------------------------------------------------+
    //|                                       2. OrderSend & Tulisan.mq4 |
    //|                                          Copyright 2021, Soe Hoe |
    //|                                            https://www.soehoe.id |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2021, Soe Hoe"
    #property link      "https://www.soehoe.id"
    #property version   "1.00"
    #property strict
    
    string    Komen   = "Takkan LOSS";
    string   objName = "soehoe";
    
    double   BalanceAwal = 1000;
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //---
       ObjectsDeleteAll(0);
       int       MinTakeProfit    = 500;
       int       MaxStopLoss       = 200;
       double    Lot             = 0.10;
       
       
       
       int row=1;
       int col=1;
       
       color cBalance = clrAqua;
       if( AccountBalance()< (BalanceAwal*0.3) ) cBalance=clrRed;
       //<, >, <=, >=, ==, !=
       
       QnText(row,"Equity");  QnText(row, DoubleToString( AccountEquity(),2),col,clrAntiqueWhite); row++;
       QnText(row,"Balance"); QnText(row,DoubleToString(AccountBalance(),2),col,cBalance); row++;
       QnText(row,"Profit");  QnText(row,    DoubleToString(AccountProfit(),2),col,clrBeige); row++;
       
       
       
       
       
       
    //---
       return(INIT_SUCCEEDED);
      }
    
    //====================================================================
    void QnText(int myList, string myText, int myCol=0,color myColor = clrYellowGreen){
       string myName = StringConcatenate(objName,myList,myCol);
       int myY = 45*myList;
       int myX = 220*myCol+20;
       
       int      chart_ID =0;
       ObjectCreate(chart_ID,myName,OBJ_LABEL,0,0,0); //Alert("test");
       ObjectSetInteger(chart_ID,myName,OBJPROP_COLOR,myColor);
       ObjectSetInteger(chart_ID,myName,OBJPROP_XDISTANCE,myX);
       ObjectSetInteger(chart_ID,myName,OBJPROP_YDISTANCE,myY);
       ObjectSetInteger(chart_ID,myName,OBJPROP_FONTSIZE,17);
       ObjectSetInteger(chart_ID,myName,OBJPROP_CORNER,CORNER_LEFT_UPPER);
       
       ObjectSetString(chart_ID,myName,OBJPROP_TEXT,myText);
       ObjectSetString(chart_ID,myName,OBJPROP_FONT,"Verdana");
       WindowRedraw();
    
    }
    //====================================================================
    //====================================================================
    
    
    //+------------------------------------------------------------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //---
       
      }
    
    
    
    
    
    
    //+------------------------------------------------------------------+
    //| Expert tick function                                             |
    //+------------------------------------------------------------------+
    void OnTick()
      {
    //---
       
      }
    //+------------------------------------------------------------------+
    
     
    • Like Like x 1
  11. Joy EA

    Joy EA Administrator Moderator

    Equity
    Credit
    Ref Point
    belum ada om, untuk tanya jawab kita fokuskan di forum ini
     
  12. Rafael Benny

    Rafael Benny New Member

    Equity
    Credit
    Ref Point
    Mau tanya Pak untuk tugas 2:
    1. bagaimana cara merapikan tampilan nilai balance, equity, dan profit agar tampil rata kanan
    2. saya mencoba memindahkan code tampilan nilai ke dalam event OnTick() karena nilainya perlu uptodate
    namun nilai yang ditampilkan kenapa lebih lambat dibanding yg tampil di terminal (tidak realtime)
    Sementara ini dulu pertanyaan saya. Terimakasih.
     
    • Like Like x 1
  13. Purwoko Hari Saputra

    Purwoko Hari Saputra New Member

    Equity
    Credit
    Ref Point
    Code:
    //+------------------------------------------------------------------+
    //|                                                  Belajar EA1.mq4 |
    //|                                         Copyright 2021, Mokodesk |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2021, Mokodesk"
    #property link      "https://www.mql5.com"
    #property version   "1.00"
    #property strict
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //---
          string NamaEA  = "Belajar EA1";
         
         
    //---
       return(INIT_SUCCEEDED);
      }
    //+-------------------------------------------------st-----------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //---
       
      }
    //+------------------------------------------------------------------+
    //| Expert tick function                                             |
    //+------------------------------------------------------------------+
    void OnTick()
      {
    //---
       
       string info = StringConcatenate("\nNAMA   :",AccountInfoString(ACCOUNT_NAME)
                                      ,"\nACCOUNT   :",string(AccountNumber())
                                      ,"\nBROKER : ",AccountInfoString(ACCOUNT_COMPANY)
                                      ,"\nLEVERAGE  :1:",AccountInfoInteger(ACCOUNT_LEVERAGE)
                                      ,"\nBALANCE   : ", DoubleToString(AccountInfoDouble(ACCOUNT_BALANCE),2)
                                      ,"\nEQUITY    :  ",DoubleToString(AccountInfoDouble(ACCOUNT_EQUITY),2)
                                      ,"\nMARGIN    : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN),2)
                                      ,"\nFREE MARGIN  : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_FREE),2)
                                      ,"\nMARGIN LEVEL  : ",DoubleToString(AccountInfoDouble(ACCOUNT_MARGIN_LEVEL),2),"%"
                                      ,"\nBID  : ",DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_BID),Digits)
                                      ,"\nASK : ", DoubleToString(SymbolInfoDouble(_Symbol,SYMBOL_ASK),Digits)
                                      ,"\nSPREAD : ", IntegerToString(SymbolInfoInteger(_Symbol,SYMBOL_SPREAD))
                                      ,"\nSYMBOL : ",_Symbol);
                             
                                     
      Comment(info);
                                     
       
       
      }
    //+------------------------------------------------------------------+
    
     

    Attached Files:

    Last edited by a moderator: 07 Sep 2021
    • Like Like x 1
  14. Sahid akbar

    Sahid akbar New Member

    Equity
    Credit
    Ref Point
    saya kngin bertanya Kenapa saya mencoba Averaging seperti di video diatas tidak berjalan, saya ingin membuat logika ketika entry posisi Minus (-) dia akan averaging sesuai Pips dan pembatasan jumlah averaging yang ditentukan
     
    • Like Like x 1
  15. RoziTrader

    RoziTrader New Member

    Equity
    Credit
    Ref Point
    Memberikan pelajaran yang bermanfaat bagi sesama trader
     
    • Like Like x 1
  16. Western

    Western New Member

    Equity
    Credit
    Ref Point
    met gabung, sebelumnya sy jg suka kutak2 katik EA dengna cara koboi, maklum hanya modal basic bahasa C, ada pertanyaan yg selama ini suka sy bingung walau kyknya terlalu dini disisi, yaitu kadang sy suka pakai function iCustom, pada suatu indicator, pertanyaannya, kalau indicator tersebut terlalu banyak nilainya ) Value, bagaimana meminimalisasi / membuat EA itu jd ringan...hal ini benar2 terasa kalau kita membuat dashboard dari suatu indicator, terima kasih
     
  17. TRAD3R

    TRAD3R New Member

    Equity
    Credit
    Ref Point
    Terima kasih Soehoe atas edukasi dasar-dasar MQL. Seperti dalam screenshot terlampir saya menuliskan enum (); ada error '(' beginning bracket expected dan 'Pilihan' - declaration without type, bgm koreksinya ?
     

    Attached Files:

  18. meto.asmo

    meto.asmo New Member

    Equity
    Credit
    Ref Point
    Ijin bertanya master suhu, apakah bisa higher high & lower low sebelumnya sebagai titik entry??
    Terima kasih atas tanggapannya master
     

Share This Page