Forex Community Place

Dapatkan hingga
$50000
karena mengundang teman
untuk memperoleh Bonus StartUp
dari InstaForex
Tidak perlu investasi!
Mulai trading tanpa
risiko dan investasi
Dengan Bonus Permulaan 1000$
Dapatkan bonus
55%
ke akun anda!
Results 1 to 4 of 4

Thread: [Help] Menyelesaikan EA untuk pribadi kalo mau pakai silahkan

  1. #1
    Orang Asing
    ----
     
    sinzdnozzo is an unknown quantity at this point sinzdnozzo's Avatar
    Join Date
    Nov 2017
    Posts
    8
    Accumulated bonus
    5 USD (What is this?)
    Thanks
    37
    Thanked 5 Times in 5 Posts

    [Help] Menyelesaikan EA untuk pribadi kalo mau pakai silahkan

    Mohon bantuannya dong aku kesulitan dalam menambahkan stop profit dan pengaktifan Ea nya berdasarkan tanggal

    contohnya gini
    ketika profit yang di inginkan telah tercapai maka ea akan mati dan tidak akan open posisi lagi sampai pada tanggal yang ditentukan

    berikut ini ea buatan pribadi yang Namanya EA AdrenalinV14

    maklum baru pemula


    Spoiler Spoiler:
    extern int MagicNumber=10001;
    extern double Lots =0.01;
    extern double StopLoss=5;
    extern double TakeProfit=5;
    extern int TrailingStop=0;
    extern int Slippage=3;
    //+------------------------------------------------------------------+
    // expert start function
    //+------------------------------------------------------------------+
    int start()
    {
    double MyPoint=Point;
    if(Digits==3 || Digits==5) MyPoint=Point*10;

    double TheStopLoss=0;
    double TheTakeProfit=0;
    if( TotalOrdersCount()==0 )
    {
    int result=0;
    if((iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,2)<iMA(N ULL,0,50,0,MODE_EMA,PRICE_CLOSE,3))&&(iStochastic( NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,1)>20)&&(iStocha stic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,1)>20)&&( iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,0)<2 0)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGN AL,0)<20)) //
    {
    result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,0,0,MagicNumber,0,Blue);
    if(result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
    if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
    OrderSelect(result,SELECT_BY_TICKET);
    OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(TheStopLoss,Digits),NormalizeDouble(TheTa keProfit,Digits),0,Green);
    }
    return(0);
    }
    if((iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,3)<iMA(NU LL,0,100,0,MODE_EMA,PRICE_CLOSE,2))&&(iStochastic( NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,1)>80)&&(iStocha stic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,1)>80)&&( iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,0)<8 0)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGN AL,0)<80)) //
    {
    result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippag e,0,0,MagicNumber,0,Red);
    if(result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
    if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
    OrderSelect(result,SELECT_BY_TICKET);
    OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(TheStopLoss,Digits),NormalizeDouble(TheTa keProfit,Digits),0,Green);
    }
    return(0);
    }
    }

    for(int cnt=0;cnt<OrdersTotal();cnt++)
    {
    OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
    if(OrderType()<=OP_SELL &&
    OrderSymbol()==Symbol() &&
    OrderMagicNumber()==MagicNumber
    )
    {
    if(OrderType()==OP_BUY)
    {
    if(TrailingStop>0)
    {
    if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
    {
    if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
    return(0);
    }
    }
    }
    }
    else
    {
    if(TrailingStop>0)
    {
    if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
    {
    if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyP oint*TrailingStop,OrderTakeProfit(),0,Red);
    return(0);
    }
    }
    }
    }
    }
    }
    return(0);
    }

    int TotalOrdersCount()
    {
    int result=0;
    for(int i=0;i<OrdersTotal();i++)
    {
    OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
    if (OrderMagicNumber()==MagicNumber) result++;

    }
    return (result);
    }

  2. The Following User Says Thank You to sinzdnozzo For This Useful Post:

    rustanto (01-20-2019)

  3. #2
    Anggota
    Bingung
     
    elfaqier will become famous soon enough elfaqier will become famous soon enough elfaqier's Avatar
    Join Date
    Sep 2017
    Location
    Indonesia
    Posts
    114
    Accumulated bonus
    43 USD (What is this?)
    Thanks
    39
    Thanked 101 Times in 47 Posts
    Wow, Aq lho baru liat isi di EAx kali nieee,,, Jelimet amat cara bacanya. dan itu kalo cara mengartikan maksud dan cara kerja EA gimana? Apa saya bisa juga buat dengan bahasa apa? Kalo bahasa logika kemudian di masukkan ke rumus diatas gimana?


    "Kesuksesan bukan hanya ditentukan seberapa banyak memiliki harta, tapi seberapa banyak membantu dan berbagi dengan harta itu"


  4. #3
    Orang Asing
    Bahagia
     
    Mujianto is an unknown quantity at this point Mujianto's Avatar
    Join Date
    Dec 2017
    Posts
    7
    Accumulated bonus
    1 USD (What is this?)
    Thanks
    1
    Thanked 2 Times in 2 Posts
    sudah di back test gan, kaya mesin mining tp 5 pips sl 5 pips

  5. <a href="">Forex Portal MT5</a>
  6. #4
    Poster Setia
    ----
     
    Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok has a reputation beyond repute Wanyok's Avatar
    Join Date
    Nov 2015
    Posts
    2,217
    Accumulated bonus
    5648 USD (What is this?)
    Saya bertemu tamu
    2 (detail lebih lanjut)
    Thanks
    2,306
    Thanked 2,334 Times in 992 Posts
    EA punya agan saya modifikasi menjadi begini:
    PHP Code:
    //+------------------------------------------------------------------+
    //|                                                         Test.mq4 |
    //|                        Copyright 2017, MetaQuotes Software Corp. |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2017, MetaQuotes Software Corp."
    #property link      "https://www.mql5.com"
    #property version   "1.00"
    #property strict

    extern int MagicNumber=10001;
    extern double Lots =0.01;
    extern double StopLoss=5;
    extern double TakeProfit=5;
    extern int TrailingStop=0;
    extern int Slippage=3;

    extern double Profit=-5;
    extern int StartHari=5;
    double BalanceAwal;
    datetime Starts;
    //+------------------------------------------------------------------+
    //| Expert initialization function                                   |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //--- create timer
       
    BalanceAwal=AccountBalance();
       
    Starts=iTime(NULL,1440,0)+(StartHari*86400);
          
    //---
       
    return(INIT_SUCCEEDED);
      }
    //+------------------------------------------------------------------+
    //| Expert deinitialization function                                 |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
      {
    //--- destroy timer
         
      
    }

    //+------------------------------------------------------------------+
    // expert start function
    //+------------------------------------------------------------------+
    int start()
    {
    if (
    AccountBalance()<=BalanceAwal+Profit)
     {
       if(
    iTime(NULL,1440,0)<Starts) {return(0);}
       else {
    BalanceAwal=AccountBalance();Starts=iTime(NULL,1440,0)+(StartHari*86400);}
     }
     
    double MyPoint=Point;
    if(
    Digits==|| Digits==5MyPoint=Point*10;

    double TheStopLoss=0;
    double TheTakeProfit=0;
    if( 
    TotalOrdersCount()==
    {
    int result=0;
    if((
    iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,2)<iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,3))&&(iStochasticNULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,1)>20)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,1)>20)&&( iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,0)<20)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,0)<20)) // 
    {
    result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,0,0,MagicNumber,0,Blue);
    if(
    result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(
    TakeProfit>0TheTakeProfit=Ask+TakeProfit*MyPoint;
    if(
    StopLoss>0TheStopLoss=Ask-StopLoss*MyPoint;
    OrderSelect(result,SELECT_BY_TICKET);
    OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
    }
    return(
    0);
    }
    if((
    iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,3)<iMA(NULL,0,100,0,MODE_EMA,PRICE_CLOSE,2))&&(iStochasticNULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,1)>80)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,1)>80)&&( iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_MAIN,0)<80)&&(iStochastic(NULL,0,5,3,3,MODE_EMA,1,MODE_SIGNAL,0)<80)) // 
    {
    result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,0,0,MagicNumber,0,Red);
    if(
    result>0)
    {
    TheStopLoss=0;
    TheTakeProfit=0;
    if(
    TakeProfit>0TheTakeProfit=Bid-TakeProfit*MyPoint;
    if(
    StopLoss>0TheStopLoss=Bid+StopLoss*MyPoint;
    OrderSelect(result,SELECT_BY_TICKET);
    OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
    }
    return(
    0);
    }
    }

    for(
    int cnt=0;cnt<OrdersTotal();cnt++)
    {
    OrderSelect(cntSELECT_BY_POSMODE_TRADES);
    if(
    OrderType()<=OP_SELL && 
    OrderSymbol()==Symbol() &&
    OrderMagicNumber()==MagicNumber 

    {
    if(
    OrderType()==OP_BUY
    {
    if(
    TrailingStop>0

    if(
    Bid-OrderOpenPrice()>MyPoint*TrailingStop)
    {
    if(
    OrderStopLoss()<Bid-MyPoint*TrailingStop)
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
    return(
    0);
    }
    }
    }
    }
    else 
    {
    if(
    TrailingStop>0

    if((
    OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
    {
    if((
    OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
    {
    OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyPoint*TrailingStop,OrderTakeProfit(),0,Red);
    return(
    0);
    }
    }
    }
    }
    }
    }
    return(
    0);
    }

    int TotalOrdersCount()
    {
    int result=0;
    for(
    int i=0;i<OrdersTotal();i++)
    {
    OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
    if (
    OrderMagicNumber()==MagicNumberresult++;

    }
    return (
    result);

    Keterangan
    PHP Code:
    extern double Profit=-5;
    extern int StartHari=5;
    double BalanceAwal;
    datetime Starts
    Kenapa Profit=-5 ?? Karena EA punya agan ini pada saat di test pada pair GBPUSD lebih gampang lossnya daripada profitnya..
    StartHari =5; artinya adalah EA akan diberhentikan selama 5 hari setelah loss >= $5.

    PHP Code:
    int OnInit()
      {
    //--- create timer
       
    BalanceAwal=AccountBalance();
       
    Starts=iTime(NULL,1440,0)+(StartHari*86400);
          
    //---
       
    return(INIT_SUCCEEDED);
      } 
    Jadi disini EA akan jalan lagi setelah tanggal lebih besar 5 hari dari tanggal starts awal (Starts=iTime(NULL,1440,0)+(StartHari*86400)
    Note : 1hari = 86400 detik.

    PHP Code:
    int start()
    {
    if (
    AccountBalance()<=BalanceAwal+Profit)
     {
       if(
    iTime(NULL,1440,0)<Starts) {return(0);}
       else {
    BalanceAwal=AccountBalance();Starts=iTime(NULL,1440,0)+(StartHari*86400);}
     } 
    Ini adalah command yang akan menjalankan lagi EA jika syarat telah terpenuhi.
    Dan setelah di BT, hasilnya seperti berikut ;
    Spoiler Spoiler:
    Click image for larger version

Name:	000000000000000000AW1zb.png
Views:	42
Size:	17.9 KB
ID:	119521

    Gambar dalam kotak merah menunjukkan bahwa setelah loss >$5, maka open berikutnya ditunda selama +/- 5 hari.

    Jika EA ini sudah dioprek dan profit, variable "extern double Profit" bisa diganti dengan harga + (plus). Dan pada int Start, diganti if (AccountBalance()>=BalanceAwal+Profit)
    { ......................
    Semoga bermanfaat.

  7. The Following 18 Users Say Thank You to Wanyok For This Useful Post:

    linnafx (07-16-2018), mustamintewa (10-06-2018), nakrowi (04-28-2018), Unregistered (8)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts