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 ...
|
|||||||
| 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. |
![]() |
| LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Member
Join Date: Mar 2009
Location: [:::INDONESIA:::]
Posts: 41
|
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...
|
|
|
|
|
|
#2 (permalink) |
|
Administrator
Join Date: Jun 2007
Posts: 1,285
|
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); |
|
|
|
|
|
#3 (permalink) | |
|
Senior Member
|
Quote:
__________________
eCandleStick.com Center Jasa Pembuatan Expert Advisor dan bisa Gratis. |
|
|
|
|
|
|
#4 (permalink) | |
|
Junior Member
Join Date: May 2009
Posts: 11
|
Quote:
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);
}
//+------------------------------------------------------------------+
|
|
|
|
|
|
|
#5 (permalink) | |
|
Senior Member
|
Quote:
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. |
|
|
|
|
|
|
#7 (permalink) |
|
Senior Member
|
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);
}
//+------------------------------------------------------------------+
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|