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

Question Mohon bantuan utk memberi target harian pada EA

Discussion in 'Belajar MQL dari Nol' started by antoe hood, 18 Jan 2016.

  1. antoe hood

    antoe hood New Member

    Equity
    Credit
    Ref Point
    salam para saudara2 dan masta2....saya mw mnta bimbingan dan bantuan untuk menambahkan target trading harian pada EA berupa % atau $.....di saat target tercapai close all dan tidak op lg....

    mohon bantuannya...karena saya newbie bngt :blush:
     
    • Dumb Dumb x 1
  2. Trancexe

    Trancexe Active Member Credit Hunter

    Equity
    Credit
    Ref Point
    Ah saya juga pensaran..
    Colek momod ngasqus
     
  3. Trancexe

    Trancexe Active Member Credit Hunter

    Equity
    Credit
    Ref Point
    masukkan di extern
    extern string DailyTarget = "== Settings For Daily Target ==";
    extern bool use_daily_target = FALSE;
    extern double daily_target = 100.0;

    masukan di int start
    {
    double Ld_4;
    //daily target
    if (use_daily_target && f0_4() >= daily_target) {
    Comment("\ndaily target achieved.");
    return (0);
    taruh di luar int start
    // cek Profit
    double f0_4() {
    int Li_0 = Day();
    double Ld_4 = 0;
    for (int Li_12 = 0; Li_12 < OrdersHistoryTotal(); Li_12++) {
    OrderSelect(Li_12, SELECT_BY_POS, MODE_HISTORY);
    if (OrderSymbol() != Symbol() || OrderMagicNumber() != magic) continue;
    if (TimeDay(OrderOpenTime()) == Li_0) Ld_4 += OrderProfit();
    }
    return (Ld_4);
    }
     
    • Like Like x 1
  4. RoyJap

    RoyJap New Member

    Equity
    Credit
    Ref Point
    muncul error om

    '}' - unexpected end of program
    '{' - unbalanced parentheses
    function must return a value
     
  5. Rahmad13579

    Rahmad13579 New Member

    Equity
    Credit
    Ref Point
     
  6. Herry Arruanpitu

    Herry Arruanpitu Member Credit Hunter

    Equity
    Credit
    Ref Point
    Alternatif lainnya :

    //Di Parameter
    extern bool UseDailyTarget = false;
    extern int DailyTarget = 10;

    //Di int start
    if(UseDailyTarget)
    {
    if(DailyProfit()>=DailyTarget)
    {
    return(0);
    }
    }

    //Fungsi ini Di Globa Variable
    double DailyProfit()
    {
    double profits=0;
    int cnt=OrdersHistoryTotal();
    for(int i=0; i<cnt; i++)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
    continue;
    if(TimeDayOfYear(OrderCloseTime())== DayOfYear() && TimeYear(OrderCloseTime())==Year())
    profits += OrderProfit() + OrderSwap() + OrderCommission();
    }
    return(profits);
    }


    SEMOGA BERMANFAAT
     

Share This Page