Forexindo.com - Forum Trader Forex Indonesia


Lowongan Pelatih Forex - Klik disini untuk lebih lengkapnya

Code : MM untuk EA plz

This is a discussion on Code : MM untuk EA plz within the MetaTrader 4 dan MQL forums, part of the Broker dan Platform category; bro.. klo mau nambahin MM untuk EA gmn sih code nya? pernah coba ambil MM code dari EA lain ga ...


Go Back   Forexindo.com - Forum Trader Forex Indonesia > Broker dan Platform > MetaTrader 4 dan MQL
Connect with Facebook

Home Forum Register VB Image Host Members List Calendar Search Today's Posts Mark Forums Read

Hey there!

It looks like you're enjoying Forexindo.com - Forum Trader Forex Indonesia but haven't created an account yet. Why not take a minute to register for your own free account now? As a member you get free access to all of our forums and posts plus the ability to post your own messages, communicate directly with other members and much more. Register now!

Already a member? Login at the top of this page to stop seeing this message.

Reply

 

LinkBack Thread Tools Display Modes
Old 16 April 2009, 10:59   #1 (permalink)
Member
 
Join Date: Mar 2009
Location: [:::INDONESIA:::]
Posts: 41
Default Code : MM untuk EA plz

bro.. klo mau nambahin MM untuk EA gmn sih code nya?

pernah coba ambil MM code dari EA lain ga jalan . malah ga bisa dijalanin EA nya. lagi coba coba bikin EA nih.. tp mau ditambahin MM biar tambah mantab...

thx ya bantuannya...
buzz is offline   Reply With Quote
Old 18 April 2009, 08:40   #2 (permalink)
Administrator
 
Join Date: Jun 2007
Posts: 1,285
Default

kalau mau yang simple ya gampang, pasang aja 1 variabel namanya BalancePerLot
misalnya kalau u isi 10000, maka balance dibagi 10000 = jumlah lot yang akan dibuka
misal klo diisi 10000 & balance u 5000, maka akan open 0.5 lot

codenya kira2
Code:
Lots=NormalizeDouble(AccountBalance()/BalancePerLot,LotDigit);
LotDigit = klo bisa 0.01 diisi 2, klo bisanya 0.1 doank, diisi 1
white_tiger is offline   Reply With Quote
Old 22 June 2009, 23:00   #3 (permalink)
Senior Member
 
Join Date: May 2009
Location: Solo
Posts: 266
Send a message via Yahoo to felicadmaja
Default

Quote:
Originally Posted by white_tiger View Post
kalau mau yang simple ya gampang, pasang aja 1 variabel namanya BalancePerLot
misalnya kalau u isi 10000, maka balance dibagi 10000 = jumlah lot yang akan dibuka
misal klo diisi 10000 & balance u 5000, maka akan open 0.5 lot

codenya kira2
Code:
Lots=NormalizeDouble(AccountBalance()/BalancePerLot,LotDigit);
LotDigit = klo bisa 0.01 diisi 2, klo bisanya 0.1 doank, diisi 1
Betul banget master, selain pake account balance juga bisa pake account equity, lebih mendekati keadaan keuangan kita yang sebenarnya.
__________________
eCandleStick.com Center Jasa Pembuatan Expert Advisor dan bisa Gratis.
felicadmaja is offline   Reply With Quote
Old 1 July 2009, 10:40   #4 (permalink)
Junior Member
 
Join Date: May 2009
Posts: 11
Default

Quote:
Originally Posted by white_tiger View Post
kalau mau yang simple ya gampang, pasang aja 1 variabel namanya BalancePerLot
misalnya kalau u isi 10000, maka balance dibagi 10000 = jumlah lot yang akan dibuka
misal klo diisi 10000 & balance u 5000, maka akan open 0.5 lot

codenya kira2
Code:
Lots=NormalizeDouble(AccountBalance()/BalancePerLot,LotDigit);
LotDigit = klo bisa 0.01 diisi 2, klo bisanya 0.1 doank, diisi 1
to @white tiger

pak bisa ga masukin kondisi ini ke contoh EA saya

jika loss pada hari ini < 100, boleh open posisi
jika loss pada hari ini = 100, tutup semua posisi, dan jangan buka posisi sampai besok pagi


ini EA nya

Code:
//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Lot=0.01;
extern int SL=100;                     //stoploss
extern int TP=100;                     //takeprofit
extern int MagicNumber=12345;
extern int SP=5;                       //slipage


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
    double 
          a,      //kijun-Sen
          b,      //tenkan-sen
          c,     //span-a
          d,     //span-b
          e;      // chinkou span
          
          
          a = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
          b = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
          c = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0);
          d = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);
          e = iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 26);
          
    if (OrdersTotal()==0)
      {
         if (a>d&&b>d&&e>d)
         {
            OrderSend(Symbol(),OP_BUY,Lot,Ask,SP,Ask-SL*Point,Ask+TP*Point,0,MagicNumber,0,Blue);
         }
         if (a<d&&b<d&&e<d)
         {
            OrderSend(Symbol(),OP_SELL,Lot,Bid,SP,Bid+SL*Point,Bid-TP*Point,0,MagicNumber,0,Red);
         }
         
      } 

//----
   return(0);
  }
//+------------------------------------------------------------------+
terimakasih sebelumnya sy haturkan
qu33nrock is offline   Reply With Quote
Old 21 July 2009, 10:51   #5 (permalink)
Senior Member
 
Join Date: Aug 2008
Posts: 355
Send a message via Yahoo to chandrawg
Default

Quote:
Originally Posted by qu33nrock View Post
to @white tiger

pak bisa ga masukin kondisi ini ke contoh EA saya

jika loss pada hari ini < 100, boleh open posisi
jika loss pada hari ini = 100, tutup semua posisi, dan jangan buka posisi sampai besok pagi


ini EA nya

Code:
//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Lot=0.01;
extern int SL=100;                     //stoploss
extern int TP=100;                     //takeprofit
extern int MagicNumber=12345;
extern int SP=5;                       //slipage


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
    double 
          a,      //kijun-Sen
          b,      //tenkan-sen
          c,     //span-a
          d,     //span-b
          e;      // chinkou span
          
          
          a = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
          b = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
          c = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0);
          d = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);
          e = iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 26);
          
    if (OrdersTotal()==0)
      {
         if (a>d&&b>d&&e>d)
         {
            OrderSend(Symbol(),OP_BUY,Lot,Ask,SP,Ask-SL*Point,Ask+TP*Point,0,MagicNumber,0,Blue);
         }
         if (a<d&&b<d&&e<d)
         {
            OrderSend(Symbol(),OP_SELL,Lot,Bid,SP,Bid+SL*Point,Bid-TP*Point,0,MagicNumber,0,Red);
         }
         
      } 

//----
   return(0);
  }
//+------------------------------------------------------------------+
terimakasih sebelumnya sy haturkan
Maksudnya 100 itu dalam satuan balance ya ??
dan maksudnya loss == 100 itu adalah (-100) atau sama dengan 100 ?

Mungkin kodenya jadi seperti ini
Code:
//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Lot=0.01;
extern int SL=100;                     //stoploss
extern int TP=100;                     //takeprofit
extern int MagicNumber=12345;
extern int SP=5;                       //slipage


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int checkprofit()
{
  double profit = 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()) profit += OrderProfit();
  }
  return (profit);
}

int start()
  {
//----
    double 
          a,      //kijun-Sen
          b,      //tenkan-sen
          c,     //span-a
          d,     //span-b
          e;      // chinkou span
          
          
          a = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
          b = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
          c = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0);
          d = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);
          e = iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 26);
          
    if ((OrdersTotal()<1)&&(checkprofit()<100))
      {
         if (a>d&&b>d&&e>d)
         {
            OrderSend(Symbol(),OP_BUY,Lot,Ask,SP,Ask-SL*Point,Ask+TP*Point,0,MagicNumber,0,Blue);
         }
         if (a<d&&b<d&&e<d)
         {
            OrderSend(Symbol(),OP_SELL,Lot,Bid,SP,Bid+SL*Point,Bid-TP*Point,0,MagicNumber,0,Red);
         }
         
      }
     else if (checkprofit()==100)
     {
     OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
     if ((OrderType()==0)||(OrderType()==1)) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0);
     }
     

//----
   return(0);
  }
//+------------------------------------------------------------------+

Last edited by chandrawg; 21 July 2009 at 10:57.
chandrawg is offline   Reply With Quote
Old 22 July 2009, 16:39   #6 (permalink)
Junior Member
 
Join Date: May 2009
Posts: 11
Default

Quote:
Originally Posted by chandrawg View Post
Maksudnya 100 itu dalam satuan balance ya ??
dan maksudnya loss == 100 itu adalah (-100) atau sama dengan 100 ?

Mungkin kodenya jadi seperti ini
maksudnya dalam pip pak bukan balance
qu33nrock is offline   Reply With Quote
Old 22 July 2009, 17:38   #7 (permalink)
Senior Member
 
Join Date: Aug 2008
Posts: 355
Send a message via Yahoo to chandrawg
Default

Quote:
Originally Posted by qu33nrock View Post
maksudnya dalam pip pak bukan balance
Kalau dalam point berarti kodenya seperti ini

Code:
//+------------------------------------------------------------------+
//|                                                     Ichimoku.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Lot=0.01;
extern int SL=100;                     //stoploss
extern int TP=100;                     //takeprofit
extern int MagicNumber=12345;
extern int SP=5;                       //slipage


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int checkprofit()
{
  double profit = 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()) 
    {
    if (OrderType()==OP_BUY) profit+=(OrderClosePrice()-OrderOpenPrice())/MarketInfo(OrderSymbol(),MODE_POINT);
    if (OrderType()==OP_SELL) profit+=(OrderOpenPrice()-OrderClosePrice())/MarketInfo(OrderSymbol(),MODE_POINT);
    }
  }
  return (profit);
}

int start()
  {
//----
    double 
          a,      //kijun-Sen
          b,      //tenkan-sen
          c,     //span-a
          d,     //span-b
          e;      // chinkou span
          
          
          a = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
          b = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
          c = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, 0);
          d = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, 0);
          e = iIchimoku(NULL, 0, 9, 26, 52, MODE_CHINKOUSPAN, 26);
          
    if ((OrdersTotal()<1)&&(checkprofit()<100))
      {
         if (a>d&&b>d&&e>d)
         {
            OrderSend(Symbol(),OP_BUY,Lot,Ask,SP,Ask-SL*Point,Ask+TP*Point,0,MagicNumber,0,Blue);
         }
         if (a<d&&b<d&&e<d)
         {
            OrderSend(Symbol(),OP_SELL,Lot,Bid,SP,Bid+SL*Point,Bid-TP*Point,0,MagicNumber,0,Red);
         }
         
      }
     else if (checkprofit()==100)
     {
     OrderSelect(0, SELECT_BY_POS, MODE_TRADES);
     if ((OrderType()==0)||(OrderType()==1)) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0);
     }
     

//----
   return(0);
  }
//+------------------------------------------------------------------+
chandrawg is offline   Reply With Quote
Old 23 July 2009, 07:16   #8 (permalink)
Junior Member
 
Join Date: May 2009
Posts: 11
Default

terimakasih atas replynya....semoga bapak banyak rezeki, sehat, dan panjang umur
qu33nrock is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On




All times are GMT +7. The time now is 19:30.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2