Friday, 9 November 2012

Cara protect EA



1. Password protection code:
Metode ini banyak di gunakan untuk memprotect EA.
Cara kerjanya dengan memberikan password untuk melock ea kita. Code ini dapat digunakan:
int start()
{extern string Please_Enter_Password = "0";// your code here....int start()
{if (password != "indo.mt5") //change to the password you give the user!
{Alert ("Wrong password!");return (0); }// your code here....}
Pada code diatas password yang digunakan adalah “indo.mt5″ dimana sudah di tuliskan di dalam MQL4 file dan kita hanya tinggal mengcompile program kita.
2. Trial period protection:
Memberikan batas waktu bagi user sehingga bila mencapai limit waktu penggunaan maka EA tidak dapat berfungsi lagi.
int start()
{string expire_date = "2006.31.06"; //<-- hard coded datetimedatetime e_d = StrToTime(expire_date);
if (CurTime() >= e_d){Alert ("The trial version has been expired!");return(0);}// your normal code!return(0);}
3. Limited account number protection:
Digunakan untuk menglock penggunaan EA pada account tertentu saja.
int start()
{
int hard_accnt = 11111; //<-- type the user account here before compilingint accnt = AccountNumber();
if (accnt != hard_accnt){Alert ("You can not use this account (" + DoubleToStr(accnt,0) + ") with this program!");return(0);}// your normal code!return(0);}
4. Limited account type protection:
Cara ini membatasi user hanya pada demo account saja.
int start()
{
bool demo_account = IsDemo();
if (!demo_account){Alert ("You can not use the program with a real account!");return(0);}// your normal code!return(0);}
5. DLL protection:
Metode ini dengan menuliskan DLL dan di export ke dalam MQL4 kita.
SEMUA EA INDI DAN SCRIPT SAYA KUMPULKAN DARI FORUM” TERBUKA, NAMUN APABILA ADA KETIDAKNYAMANAN SAYA MOHON MAAF

ANEKA SCRIPT ORDER DENGAN RISK MANAGEMENT


SCRIPT ORDER DENGAN RISK MANAGEMENT
::::BUY SCRIPT:::::
//+------------------------------------------------------------------+
//| Buy with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = true;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Buy";
extern double Entry = 0.0000;
string Input = " Buy Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_BUYSTOP;
if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT;
if (Entry == 0) {Entry = Ask; Mode = OP_BUY;}
double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;
if (UseStop == false) SLB = 0;
if (UseTakeProfit == false) TPB = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, "Rubi_Sniper_BUY", 0, NULL, LimeGreen);
return(0);
}
//+------------------------------------------------------------------+
::::SELL SCRIPT::::
//+------------------------------------------------------------------+
//| Sell with MM |
//| Copyright © 2011, Rubianto |
//| Rubi_Sniper |
//+------------------------------------------------------------------+
#property copyright "Copyright © Rubi_Sniper_2011"
#property link "rubianto.md@gmail.com"
//#property show_inputs
extern double Lots = 1;
extern bool UseMoneyMgmt = True;
extern double RiskPercent = 5;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 30;
extern double TakeProfit = 5;
extern string Note="0 in Entry field means Market Order Sell";
extern double Entry = 0.0000;
string Input = " Sell Price ";
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
double Risk = RiskPercent / 100;
if (UseMoneyMgmt)
Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
int Mode = OP_SELLSTOP;
if (Bid < Entry && Entry > 0) Mode = OP_SELLLIMIT;
if (Entry == 0) {Entry = Bid; Mode = OP_SELL;}
double SLS = Entry+StopLoss*Point, TPS = Entry - TakeProfit * Point;
if (UseStop == false) SLS = 0;
if (UseTakeProfit == false) TPS = 0;
if(Lots > 0)
OrderSend(Symbol(),Mode, Lots, Entry, 2, SLS, TPS, "Rubi_Sniper_SELL",0, NULL, Red);
return(0);
}
//+------------------------------------------------------------------+
Script Buy n Sell dari bos Fkipoi Rian duet Taufik Kiads
SCRIPT BUY :
//====================================================
//IA1_script_buy_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
buy(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void buy(double lot, double tp, double sl, int slip)
{
double askprice = Ask;
if (tp>0)tp = askprice + (tp * Point);
if (sl>0)sl = askprice - (sl *Point);
OrderSend(Symbol(), OP_BUY, lot, askprice, slip, sl, tp, "IA1_Buy-"+repeat, 0, 0, Blue);
return(0);
}
SCRIPT SELL :
//====================================================
//IA1_script_sell_multiple.mq4
//depok.investor@gmail.com
//Note: Adjust lot1,takeprofit1 and stoploss1 as u like
//build:31/10/2011 taufik
//====================================================
#property copyright "IA1_2011"
#property link "depok.investor@gmail.com"
double lot1 =1.0;
int total_entry =5;
int takeprofit1 =5;
int stoploss1 =0;
int slippage1 =5;
int repeat =1;
int start()
{
while (repeat<=total_entry)
{
sell(lot1,takeprofit1,stoploss1,slippage1);
Sleep(1000);
int err=GetLastError();
if (err==0) {repeat++;}
else {repeat=repeat;}
}
}
void sell(double lot, double tp, double sl, int slip)
{
double bidprice = Bid;
if (tp>0) tp = bidprice - (tp * Point);
if (sl>0) sl = bidprice + (sl * Point);
OrderSend(Symbol(), OP_SELL, lot, bidprice, slip, sl, tp, "IA1_Sell-"+repeat, 0, 0, Red);
return(0);
}

Script Close order lengkap n muantap


##script Close order lengkap n muantap
//+------------------------------------------------------------------+
//| Close order lengkap n muantap.mq4 |
//| Oprekan by Bambang Sugianto |
//+------------------------------------------------------------------+
#property copyright "Bambang Sugianto"
#property show_inputs
#include
//+------------------------------------------------------------------+
//| input parameters: |
//+------------------------------------------------------------------+
extern bool CloseAllSymbols = false;
extern string Important = "Select one of the following:";
extern bool CloseOpenOrdersAndCancelPending = true;
extern bool CloseOpenOrders = false;
extern bool DeleteAllPendingOrders = false;
extern bool CloseOrdersWithPlusProfit = false;
extern bool CloseOrdersWithMinusProfit = false;
extern bool CloseOrdersOpenedBeforeToday = false;
//+------------------------------------------------------------------+
//| global variables to program: |
//+------------------------------------------------------------------+
double Price[2];
int giSlippage;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
void start() {
int iOrders=OrdersTotal()-1, i;
if(CloseOpenOrdersAndCancelPending) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
else if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
}
}
if(CloseOpenOrders) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
if(DeleteAllPendingOrders) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
}
}
else if(CloseOrdersWithPlusProfit) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderProfit() >= 0)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
else if(CloseOrdersWithMinusProfit) {
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderProfit() <= 0)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}
}
}
}
}
else if( CloseOrdersOpenedBeforeToday) {
datetime tTodayStart=TimeCurrent()-TimeHour(TimeCurrent())*60*60-TimeMinute(TimeCurrent())*60;
for(i=iOrders; i>=0; i--) {
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderOpenTime() < tTodayStart)) {
if ( OrderSymbol()==Symbol() || CloseAllSymbols == true ) {
if((OrderType()<=OP_SELL) && GetMarketInfo()) {
if(!OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
}}
else if(OrderType()>OP_SELL) {
if(!OrderDelete(OrderTicket())) Print(OrderError());
}
}
}
} Alert("beres juragan...perintah CLOSE sudah terlaksana..." ); // tambahan alert
}
//+------------------------------------------------------------------+
//| Function..: OrderError |
//+------------------------------------------------------------------+
string OrderError() {
int iError=GetLastError();
return(StringConcatenate("Order:",OrderTicket()," GetLastError()=",iError," ",ErrorDescription(iError)));
}
//+------------------------------------------------------------------+
//| Function..: GetMarketInfo |
//| Returns...: bool Success. |
//+------------------------------------------------------------------+
bool GetMarketInfo() {
RefreshRates();
Price[0]=MarketInfo(OrderSymbol(),MODE_ASK);
Price[1]=MarketInfo(OrderSymbol(),MODE_BID);
double dPoint=MarketInfo(OrderSymbol(),MODE_POINT);
if(dPoint==0) return(false);
giSlippage=(Price[0]-Price[1])/dPoint;
return(Price[0]>0.0 && Price[1]>0.0);
}

Monday, 29 October 2012

SCRIPT EA HEDGING


SCRIPT EA HEDGING

Posted: May 15, 2011 in Expert Advisor
1
 
 
 
 
 
 
Rate This

Ini salah satu contoh coding EA Hedging silahkan dipelajari dan dioprex sesuai dengan sistem teman-teman…
#property copyright “Andi Goen”
#property link “http://facebook.com/andi.goen”
extern string email = “”;
extern string Pair = “USDJPY”;
extern double Lots = 0.1;
extern int TakeProfit = 30;
extern int StopLoss = 300;
extern bool ConstantStop = TRUE;
extern int Step1 = 30;
extern int TP1 = 30;
extern int Step2 = 30;
extern int TP2 = 30;
extern int Step3 = 30;
extern int TP3 = 30;
extern int Step4 = 30;
extern int TP4 = 30;
extern int Step5 = 30;
extern int TP5 = 30;
extern int Step6 = 30;
extern int TP6 = 30;
extern int Step7 = 30;
extern int TP7 = 30;
extern int Step8 = 30;
extern int TP8 = 30;
extern int Step9 = 30;
extern int TP9 = 30;
extern int Step10 = 30;
extern int TP10 = 30;
int g_slippage_192 = 3;
int gi_196 = 2;
extern int StartHour = 0;
extern int EndHour = 24;
int g_magic_208 = 111;
int gi_212 = D’01.01.2012 14:00′;
int gi_216 = 1533279600;
string gs_220 = “Silahkan Trading Live”;

int start() {
double l_price_0;
double l_price_8;
double l_price_16;
double l_lots_24;
double l_pips_32;
double l_pips_40;
if (Year() > 2012) {
Alert(“EA_Hedging Expaired”);
return (0);
}
int l_ticket_48 = 0;
int l_ticket_52 = 0;
int l_ticket_56 = 0;
int l_ticket_60 = 0;
int l_ticket_64 = 0;
int l_ticket_68 = 0;
double l_ord_lots_72 = 0;
double l_ord_lots_80 = 0;
double l_ord_open_price_88 = 0;
double l_ord_open_price_96 = 0;
double l_ord_takeprofit_104 = 0;
double l_ord_takeprofit_112 = 0;
double l_ord_lots_120 = 0;
double l_ord_lots_128 = 0;
double l_ord_lots_136 = 0;
double l_ord_lots_144 = 0;
double ld_152 = 0;
double ld_160 = 0;
for (int l_pos_168 = 0; l_pos_168 < OrdersTotal(); l_pos_168++) {
OrderSelect(l_pos_168, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_208) {
if (OrderType() == OP_BUY && l_ticket_48 < OrderTicket()) {
l_ord_lots_72 = OrderLots();
l_ord_open_price_88 = OrderOpenPrice();
l_ticket_48 = OrderTicket();
l_ord_takeprofit_112 = OrderTakeProfit();
if (OrderLots() == Lots) ld_152 = OrderOpenPrice() – StopLoss * Point;
}
if (OrderType() == OP_SELL && l_ticket_52 < OrderTicket()) {
l_ord_lots_80 = OrderLots();
l_ord_open_price_96 = OrderOpenPrice();
l_ticket_52 = OrderTicket();
l_ord_takeprofit_104 = OrderTakeProfit();
if (OrderLots() == Lots) ld_160 = OrderOpenPrice() + StopLoss * Point;
}
if (OrderType() == OP_BUYLIMIT) {
l_ticket_56 = OrderTicket();
l_ord_lots_136 = OrderLots();
}
if (OrderType() == OP_SELLLIMIT) {
l_ticket_60 = OrderTicket();
l_ord_lots_144 = OrderLots();
}
if (OrderType() == OP_BUYSTOP) {
l_ticket_64 = OrderTicket();
l_ord_lots_120 = OrderLots();
}
if (OrderType() == OP_SELLSTOP) {
l_ticket_68 = OrderTicket();
l_ord_lots_128 = OrderLots();
}
}
}
if (l_ticket_48 == 0) {
if (l_ticket_56 != 0) OrderDelete(l_ticket_56);
if (l_ticket_64 != 0) OrderDelete(l_ticket_64);
l_price_8 = Ask – StopLoss * Point;
if (StopLoss = StartHour && TimeHour(TimeCurrent()) = gi_212 && TimeCurrent() <= gi_216) OrderSend(Symbol(), OP_BUY, Lots, Ask, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Blue);
else Alert(gs_220);
}
}
if (l_ticket_52 == 0) {
if (l_ticket_60 != 0) OrderDelete(l_ticket_60);
if (l_ticket_68 != 0) OrderDelete(l_ticket_68);
l_price_8 = Bid + StopLoss * Point;
if (StopLoss = StartHour && TimeHour(TimeCurrent()) = gi_212 && TimeCurrent() <= gi_216) OrderSend(Symbol(), OP_SELL, Lots, Bid, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Red);
else Alert(gs_220);
}
}
if (l_ticket_48 != 0 && l_ticket_56 == 0) {
l_pips_40 = FinalStep(l_ord_lots_72);
l_pips_32 = FinalTP(l_ord_lots_72);
l_price_0 = l_ord_open_price_88 – l_pips_40 * Point;
if (ConstantStop == FALSE) l_price_8 = l_price_0 – StopLoss * Point;
else l_price_8 = ld_152;
if (StopLoss <= 0) l_price_8 = 0;
l_price_16 = l_price_0 + l_pips_32 * Point;
l_lots_24 = NormalizeDouble(2.0 * l_ord_lots_72, gi_196);
OrderSend(Symbol(), OP_BUYLIMIT, l_lots_24, l_price_0, g_slippage_192, l_price_8, l_price_16, "EA_Hedging", g_magic_208, 0, Blue);
}
if (l_ticket_52 != 0 && l_ticket_60 == 0) {
l_pips_40 = FinalStep(l_ord_lots_80);
l_pips_32 = FinalTP(l_ord_lots_80);
l_price_0 = l_ord_open_price_96 + l_pips_40 * Point;
if (ConstantStop == FALSE) l_price_8 = l_price_0 + StopLoss * Point;
else l_price_8 = ld_160;
if (StopLoss <= 0) l_price_8 = 0;
l_price_16 = l_price_0 – l_pips_32 * Point;
l_lots_24 = NormalizeDouble(2.0 * l_ord_lots_80, gi_196);
OrderSend(Symbol(), OP_SELLLIMIT, l_lots_24, l_price_0, g_slippage_192, l_price_8, l_price_16, "APS_Hedging", g_magic_208, 0, Red);
}
for (l_pos_168 = 0; l_pos_168 < OrdersTotal(); l_pos_168++) {
OrderSelect(l_pos_168, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderType() == OP_BUY && l_ticket_48 != 0 && OrderMagicNumber() == g_magic_208) {
if (ConstantStop == FALSE) l_price_8 = l_ord_open_price_88 – StopLoss * Point;
else l_price_8 = ld_152;
if (StopLoss <= 0) l_price_8 = 0;
if (l_ticket_48 != OrderTicket()) l_price_16 = l_ord_takeprofit_112;
else l_price_16 = OrderTakeProfit();
if (l_price_16 != OrderTakeProfit() || l_price_8 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, l_price_16, 0, CLR_NONE);
}
if (OrderSymbol() == Symbol() && OrderType() == OP_SELL && l_ticket_52 != 0 && OrderMagicNumber() == g_magic_208) {
if (ConstantStop == FALSE) l_price_8 = l_ord_open_price_96 + StopLoss * Point;
else l_price_8 = ld_160;
if (StopLoss <= 0) l_price_8 = 0;
if (l_ticket_52 != OrderTicket()) l_price_16 = l_ord_takeprofit_104;
else l_price_16 = OrderTakeProfit();
if (l_price_16 != OrderTakeProfit() || l_price_8 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_8, l_price_16, 0, CLR_NONE);
}
}
return (0);
}
int FinalStep(double ad_0) {
ad_0 = NormalizeDouble(ad_0 / Lots, 0);
switch (ad_0) {
case 1.0:
return (Step1);
case 2.0:
return (Step2);
case 4.0:
return (Step3);
case 8.0:
return (Step4);
case 16.0:
return (Step5);
case 32.0:
return (Step6);
case 64.0:
return (Step7);
case 128.0:
return (Step8);
case 256.0:
return (Step9);
case 512.0:
return (Step10);
}
return (Step10);
}
int FinalTP(double ad_0) {
ad_0 = NormalizeDouble(ad_0 / Lots, 0);
switch (ad_0) {
case 1.0:
return (TP1);
case 2.0:
return (TP2);
case 4.0:
return (TP3);
case 8.0:
return (TP4);
case 16.0:
return (TP5);
case 32.0:
return (TP6);
case 64.0:
return (TP7);
case 128.0:
return (TP8);
case 256.0:
return (TP9);
case 512.0:
return (TP10);
}
return (TP10);
}

Sunday, 28 October 2012

Moving Average

Moving Average 
Author: MetaQuotes
Download: 
Moving Average.mq4 (4.6 Kb)

EA Moving Average menghasilkan signal perdagangan dengan menggunakan moving average. Membuka dan menutup posisi dilakukan ketika moving average memenuhi harga di bar yang baru terbentuk (indeks bar setara dengan 1). Ukuran lot akan dioptimalkan sesuai dengan algoritma khusus.

Money Management yang digunakan sangat sederhana, tetapi efektif, kontrol atas setiap volume posisi dilakukan tergantung pada hasil transaksi sebelumnya. Algoritma ini diimplementasikan oleh fungsi (LotsOptimized). Ukuran lot dasar dihitung berdasarkan risiko maksimum yang diijinkan:

Lot = NormalizeDouble (AccountFreeMargin () * MaximumRisk/1000.0, 1);

Parameter MaximumRisk menampilkan persentase risiko dasar untuk setiap transaksi. Biasanya memiliki nilai antara 0,01 (1%) dan 1 (100%). Sebagai contoh, jika free margin(AccountFreeMargin) setara dengan $ 20.500 dan aturan pengelolaan modal menggunakan resiko 2%, ukuran lot dasar adalah 20500 * 0,02 / 1000 = 0,41.

DecreaseFactor adalah sejauh mana ukuran lot akan berkurang setelah perdagangan yang tidak menguntungkan. nilai normal adalah 2,3,4,5. Jika transaksi sebelumnya yang tidak menguntungkan, volume berikutnya akan berkurang dengan faktor DecreaseFactor untuk menunggu periode tidak menguntungkan tersebut. Ini adalah faktor utama dalam algoritma pengelolaan modal. Idenya sangat sederhana: jika berhasil meningkatkan perdagangan, EA bekerja dengan banyak dasar untuk menghasilkan keuntungan maksimal. Setelah transaksi tidak menguntungkan pertama, EA akan “mengurangi kecepatan” sampai transaksi positif. Algoritma ini memungkinkan untuk menonaktifkan “mengurangi kecepatan”, untuk melakukannya, kita harus menentukan DecreaseFactor = 0. Jumlah transaksi terakhir tidak menguntungkan berurutan, akan dihitung ulang berdasarkan ini:

if (loss> 1) lot = NormalizeDouble (lots loss * / DecreaseFactor, 1);

if (lot <0,1) lot = 0,1;

EA ini baik digunakan untuk chart harian.

agan2 bisa belajar di http://instaforex.co.id/mt4/moving-average/

Step marty 0.01 namun lot tak terjadi martiyem

ini khusus untuk lot awal = 0.01, walau ada exp = 2, lot selanjutnya tetap sama
klu lot awal dimulai 0.02, maka lot marti selanjutnya berjalan semsetinya sesuai dengan perkalian exp nya

masalah :
http://indo.mt5.com/showthread.php?1793-GRATIS-Profitable-EA-BHCM-!/page38

maaf nih agan semua , sy mau tanya
ane pasang multyply nya =1 
kok OP selanjutnya malah naik sendiri lotnya , kira2 salahnya apa y



terlihat walau multiply = 1, namun lot naik 0.01

jawab :
Coba dilihat pada bagian yang ini....

LotBuy = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
LotSell = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);


MathMax = Menampilkan nilai tertinggi.
lotstep = MarketInfo(Symbol(), MODE_LOTSTEP); ==>> asumsi jika memakai account demo instaforex MODE_LOTSTEP = 0.01


Jadi kesimpulannya seperti ini

LotBuy/LotSell = MathMax(Multiply*OrderLots(),OrderLots()+lotstep)
LotBuy/LotSell = MathMax(1*0.1,0.1+0.01) 
LotBuy/LotSell = MathMax(0.1,0.11)
LotBuy/LotSell = 0.11


Kalau mau tidak bertambah lotnya bisa dicoba dihilangkan "+lotstep" nya..... 

ganti semua ini :
Code:
LotBuy      = MathMax(Multiply*OrderLots(),OrderLots()+lotstep);
LotBuy      = MathMax(LotBuy, minlot);
dengan ini :
Code:
LotBuy      = MathMax(Multiply*OrderLots(),minlot);
--------------
@iniangga & hermit88
Betul bagian itu yang diubah, maaf kemarin mo reply blom sempet masih sibuk.
Dan itu tidak menyalahi konsep Martingale, karena emang sebenarnya itu kode aslinya dulu ya saya bikin seperti itu 
Lalu kenapa saya tambahkan lotstep?
Kalo menyimak di post2 depan, pasti tahu sejarahnya. Dulu ada yang coba penambahan lot-nya ngga jalan karena menggunakan multiply 1.5
1.5 x0.1 = 0.15
Nah jika lotstep dari broker yang bersangkutan adalah 0.1, maka perhitungan tadi akan menghasilkan tetap 0.1 karena penambahan lot (lotstep) yang diijinkan minimal 0.1
Kalo di Insta lotstep=0.01 jadi no problemo 
Ok, kiranya masalah ini cukup jelas. Jika ada yang kurang sreg, sampaikan saja...
Saya sangat berterima kasih kepada iniangga & hermit88 karena bersedia membantu menjelaskan coding-nya. Karena kebanyakan orang males belajar, maunya langsung dapet instan hehe..  
Belajar MQL ngga ada ruginya, terutama jika setiap hari MT4 jadi "santapan" sehari-hari, minimal bisa edit2 indi/EA dikit2 khan lumayan.

--------------------------
Masalah saya sdh ada exp namun lot tidak exponential..

tambahkan perintah :

di input :

double gd_1=1;


void SetDigits() {
   if (Digits == 5 || Digits == 3) gd_160 = 10;
   if(MarketInfo(Symbol(),MODE_MINLOT) == 0.01) gd_1 = 2;
}



di perintah order :

if (OrderSend(Symbol(), OP_SELLSTOP, NormalizeDouble(LotsExponential * Lots, gd_1), NormalizeDouble(ld_8 - KillZone * Point * gd_160, Digits), Slippage, l_price_24, l_price_32, gs_007_148, Magic_Number, 0, Red) == -1) {
               l_error_0 = GetLastError();

Saturday, 27 October 2012

logic tradetime


jumat tidak trading
//taro dibagian atas
extern bool   OPFriday = false;  //artinya false = tidak buka posisi baru di hari jumat

//replace tradetime dgn yg ini
bool TradeTime() 
{
   bool TradingTime = false;
   if(StartTime < StopTime)
   {
      if (Hour() >= StartTime && Hour() <= StopTime) TradingTime = true;
      if(OPFriday == false)
      {
         if(TradingTime == true)
         {
            if(DayOfWeek() == 5) TradingTime = false;
         }
      }
   }   
   else if(StartTime > StopTime)
   {
      if (Hour() >= StartTime || Hour() <= StopTime) TradingTime = true;
      if(OPFriday == false)
      {
         if(TradingTime == true)
         {
            if(DayOfWeek() == 5 && Hour() < StartTime) TradingTime = false;
         }
      }
      if(DayOfWeek() == 5 && Hour() >= StartTime)  TradingTime = false;
   }
   return(TradingTime); 
}