expert advisor blind hedging - sekedar catatan
Headlines News :
Home » » expert advisor blind hedging

expert advisor blind hedging

Written By Unknown on Jumat, 01 Agustus 2014 | 23.14

//+------------------------------------------------------------------+
//|                                     Givonly_BHCM Version 2.2.mq4 |
//|                                                  Coder : Givonly |
//|                                      Target Profit Loss by Ideta |
//|                                    Re-entry by Paulus InstaValas |
//|                Any modification are welcome & let's keep it FREE |
//|                                                                  |
//|                          http://indo.mt5.com/showthread.php?1793 |
//|         Keterangan lengkap lihat bagian bawah source program ini |
//|       For more details please see the bottom of this source code |
//+------------------------------------------------------------------+
#property copyright "Givonly"
#property link      "http://indo.mt5.com/member.php?382-Givonly"

//+------------------------------------------------------------------+
// INI ADALAH PARAMETER YANG NANTINYA BISA DIINPUT OLEH USER
// CARANYA DIDEPAN-NYA SELALU DIKASIH KATA extern
//+------------------------------------------------------------------+
extern bool StatusTrading=true;
extern bool PendingStop=false;
extern bool ReEntry=false;
extern int JarakOP=5;
extern double Lot1=0.1;
extern double Multiply=2;
extern double Target_Persen=1;
extern double Loss_Persen=50;
extern int SlipPage=3;
extern int MagicNumber=999;

//+------------------------------------------------------------------+
// BERIKUT ADALAH DEKLARASI VARIABEL2 YANG NANTINYA DIPAKAI OLEH PROGRAM
// PERHATIKAN JENIS2/TIPE VARIABEL-NYA SERTA CARA PENULISANNYA
// YANG SERING DIPAKAI ADALAH int, doube, bool, string
//+------------------------------------------------------------------+
int      x, ticket, spread, stoplevel,
         JumlahBuy, JumlahSell, JumlahBuyStop, JumlahSellStop, JumlahBuyGroup, JumlahSellGroup;
double   LotBuy, LotSell, lotstep, minlot, TotalProfit, NextBuy, NextSell,
         Target_Profit, Target_Kehilangan_Modal, Modal_Awal;
string   komen, status, demore, rentry, pps, warning;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   Comment("\nGivonly_BHCM Loading...");
   Target_Profit = AccountBalance() * Target_Persen / 100;
   Target_Kehilangan_Modal = AccountBalance() - AccountBalance() * Loss_Persen / 100;
   Modal_Awal=AccountBalance();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   lotstep  = MarketInfo(Symbol(), MODE_LOTSTEP);
   minlot   = MarketInfo(Symbol(), MODE_MINLOT);
   stoplevel= MarketInfo(Symbol(), MODE_STOPLEVEL);
   spread   = MarketInfo(Symbol(), MODE_SPREAD);
//+------------------------------------------------------------------+
// BARIS PROGRAM BERIKUT UNTUK MENGAMBIL DATA2 DARI OP YANG MASIH AKTIF
// DI SINI KITA INGIN MENCARI NILAI LOT, PROFIT, SERTA JUMLAH BUY & SELL
//+------------------------------------------------------------------+
// Perhatikan beberapa nilai yang diinput berikut
   JumlahBuy=0;         JumlahSell=0;
   JumlahBuyStop=0;     JumlahSellStop=0;
   JumlahBuyGroup=0;    JumlahSellGroup=0;
   LotBuy=Lot1;         LotSell=Lot1;
   TotalProfit=0;

// Nilai2 tersebut akan berubah setelah melalui baris2 kode di bawah ini
   for(x=0; x<OrdersTotal(); x++)
   {
     
      OrderSelect(x,SELECT_BY_POS,MODE_TRADES);
      if (OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber) continue;
      if (OrderType()==OP_BUY)   {
         LotBuy      = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
         LotBuy      = MathMax(LotBuy, minlot);
         NextBuy     = OrderOpenPrice()+JarakOP*Point;
         TotalProfit+= OrderProfit();
         JumlahBuy++;
         JumlahBuyGroup++;
         }
      else
      if(OrderType()==OP_SELL)   {
         LotSell     = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
         LotSell     = MathMax(LotSell, minlot);
         NextSell    = OrderOpenPrice()-JarakOP*Point;
         TotalProfit+= OrderProfit();
         JumlahSell++;
         JumlahSellGroup++;
         }
      else
      if(OrderType()==OP_BUYSTOP)   {
         LotBuy      = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
         LotBuy      = MathMax(LotBuy, minlot);
         NextBuy     = OrderOpenPrice()+JarakOP*Point;
         JumlahBuyStop++;
         JumlahBuyGroup++;
         }
      else
      if(OrderType()==OP_SELLSTOP)   {
         LotSell     = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
         LotSell     = MathMax(LotSell, minlot);
         NextSell    = OrderOpenPrice()-JarakOP*Point;
         JumlahSellStop++;
         JumlahSellGroup++;
         }
   }

//CLOSE ALL POSITIONS AFTER TARGET
   if (TotalProfit >= Target_Profit) StatusTrading=False;
   if (AccountEquity() <= Target_Kehilangan_Modal)StatusTrading=False;

//+------------------------------------------------------------------+
// INILAH LOGIC UTAMA UNTUK OP
// PERHATIKAN YANG PALING PENTING ADALAH SETELAH KATA if
//+------------------------------------------------------------------+
//OPEN BUY
      if(   StatusTrading
         && (JumlahBuy==0 || (JumlahBuy<=JumlahSell && Ask>=NextBuy && !PendingStop)  )
        )   {
         komen=StringConcatenate("BUY STEP ",JumlahBuy+1," | ",Symbol());
         ticket=OrderSend(Symbol(),OP_BUY,LotBuy,Ask,SlipPage,0,0,komen,MagicNumber,0,CLR_NONE);
         if(ticket>0) if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) OrderPrint();
         if(GetLastError()==138) RefreshRates();
         }

//OPEN SELL
      if(   StatusTrading
         && (JumlahSell==0 || (JumlahSell<=JumlahBuy && Bid<=NextSell && !PendingStop)  )
        )   {
         komen=StringConcatenate("SELL STEP ",JumlahSell+1," | ",Symbol());
         ticket=OrderSend(Symbol(),OP_SELL,LotSell,Bid,SlipPage,0,0,komen,MagicNumber,0,CLR_NONE);
         if(ticket>0) if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) OrderPrint();
         if(GetLastError()==138) RefreshRates();
         }

//OPEN BUYSTOP
      if(StatusTrading && JumlahBuyGroup<=JumlahSell && JumlahBuy>0 && PendingStop)   {
         komen=StringConcatenate("BUY STEP ",JumlahSell+1," | ",Symbol());
         ticket=OrderSend(Symbol(),OP_BUYSTOP,LotBuy,NextBuy,0,0,0,komen,MagicNumber,0,CLR_NONE);
         if(ticket>0) if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) OrderPrint();
         if(GetLastError()==138) RefreshRates();
         }

//OPEN SELLSTOP
      if(StatusTrading && JumlahSellGroup<=JumlahBuy && JumlahSell>0 && PendingStop)   {
         komen=StringConcatenate("SELL STEP ",JumlahBuy+1," | ",Symbol());
         ticket=OrderSend(Symbol(),OP_SELLSTOP,LotSell,NextSell,0,0,0,komen,MagicNumber,0,CLR_NONE);
         if(ticket>0) if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) OrderPrint();
         if(GetLastError()==138) RefreshRates();
         }

//+------------------------------------------------------------------+
// INI BLOK PROGRAM UNTUK MENGONTROL/MODIFIKASI ORDER YANG MASIH AKTIF
// MISALNYA EDIT SL, TP, CLOSE, dll
//+------------------------------------------------------------------+

   for(x=0; x<OrdersTotal(); x++)
   {
      OrderSelect(x, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol()!=Symbol() || OrderMagicNumber()!=MagicNumber) continue;

// KONTROL BUY
      if (OrderType()==OP_BUY)   {
         if(!StatusTrading)
            OrderClose(OrderTicket(), OrderLots(), Bid, SlipPage, Blue);
         }

// KONTROL SELL
         if(OrderType()==OP_SELL)   {
         if(!StatusTrading)
            OrderClose(OrderTicket(), OrderLots(), Ask, SlipPage, Red);
         }

// KONTROL BUYSTOP
      if (OrderType()==OP_BUYSTOP)   {
         if(!StatusTrading)
            OrderDelete(OrderTicket());
         }

// KONTROL SELLSTOP
         if(OrderType()==OP_SELLSTOP)   {
         if(!StatusTrading)
            OrderDelete(OrderTicket());
         }

   }
  
// Re-entry by Paulus InstaValas
      if(ReEntry==true && StatusTrading==false && JumlahSell==0 && JumlahBuy==0)   {
         Target_Profit = AccountBalance() * Target_Persen / 100;
         Target_Kehilangan_Modal = AccountBalance() - AccountBalance() * Loss_Persen / 100;
         Modal_Awal=AccountBalance();
         StatusTrading=true;
         }

//+------------------------------------------------------------------+
//COMMENT YANG TAMPIL DI POJOK KIRI ATAS
//+------------------------------------------------------------------+
   if(StatusTrading)  status="AKTIF";
   else               status="NON AKTIF";
   if(IsDemo())       demore="DEMO";
   else               demore="REAL";
   if(ReEntry)        rentry="YA";
   else               rentry="TIDAK";
   if(PendingStop) pps="YA";
   else                 pps="TIDAK";
   warning="";
   if(PendingStop && JarakOP<stoplevel)
   warning=">> UNTUK BISA MENGGUNAKAN PENDING STOP, JarakOP HARUS LEBIH BESAR ATAU SAMA DENGAN Stop Level !";

  Comment( "\nGIVONLY Blind Hedging Counfused Martingale [BHCM]",                          "\n=================================="
            "\nStatus Trading : ",status,
           "\nPending Stop : ",pps,
            "\nRe-Entry Order : ",rentry,
            "\nJarak OP : ",JarakOP,
            "\nLot Awal : ",Lot1,
           "\nMultiply : ",Multiply,
            "\nTarget Profit : ",Target_Persen,"%",
          "\nTarget Loss : ",Loss_Persen,"%",
            "\n==================================",
            "\nModal Awal : ",Modal_Awal,
            "\nModal Sekarang : ",AccountEquity(),
            "\nTarget Modal - Loss : ",Target_Kehilangan_Modal,
            "\nTarget Profit : ",Target_Profit,
            "\nProfit/Loss ",Symbol()," : ",TotalProfit,
            "\nTotal Profit/Loss : ",AccountProfit(),
            "\n==================================",
           "\nBroker : ",AccountCompany()," (",demore,")",
           "\nPair : ",Symbol(),
           "\nSpread : ",spread,
          "\nMinimal Lot : ",minlot,
           "\nStop Level : ",stoplevel,
            "\n==================================",warning
            );

   return(0);
  }
//+------------------------------------------------------------------+
// EA INI BISA DIPAKAI OLEH SIAPAPUN SECARA GRATIS DENGAN LEVEL RESIKO
// DITANGGUNG OLEH MASING-MASING PENGGUNANYA.
// SOURCE DALAM EA INI BISA DIGUNAKAN SEBAGAI SARANA PEMBELAJARAN PEMULA
// ANDA BOLEH MEMODIFIKASI SERTA MENCANTUMKAN NAMA ANDA DI SOURCE INI
// Nama / ID Coder serta para Contributor mohon JANGAN DIHAPUS :)
// PENAMBAHAN VARIABEL SEBAIKNYA GUNAKAN ISTILAH YANG MUDAH DIPAHAMI ORANG AWAM
// PAKAI BAHASA INDONESIA MUNGKIN LEBIH MEMBANTU
// SENGAJA DALAM MQ4 INI TIDAK SAYA BUAT PROCEDURE/FUNCTION YANG RUMIT-RUMIT
// SARAN & MASUKAN BISA KE ALAMAT WEBSITE BERIKUT :
// http://indo.mt5.com/showthread.php?1793
//
// TERIMA KASIH.
// SALAM PROFIT,
// Givonly[trader biasa].
//
//+------------------------------------------------------------------+
// Credit to :
// > Ideta for Target Loss & Profit
// > Paulus InstaValas.com : simple re-entry :)
// > You next..? :)
//+------------------------------------------------------------------+
// It's a free EA developed by Indonesian Traders
// If you want to contribute please visit this site:
// http://indo.mt5.com/showthread.php?1793
// Any modification are welcome and please keep it FREE !!!
//
// Regard,
// Givonly and friends ;)
//+------------------------------------------------------------------+

Share this article :

1 komentar:

jangan banyak nanya klo bisa ditambah kekurangany.. atau cukup ninggalin jejak ajah... cos blog ini cuma copas

Live Traffic

hitstat

 
Support : Creating Website | Johny Template | Mas Template
Proudly powered by Blogger
Copyright © 2014. sekedar catatan - All Rights Reserved
Template Design by Creating Website Published by Mas Template