Jump to content

Recommended Posts

Posted

Re: SWR Grid EA

 

Hi bro scarface,

thank you very much! :) It works on my demo account with 4-digit broker but not on my demo account with 5-digit broker. :?: Could you have a look again to solve the 5-digit problem (or maybe it is another reason?) if it is not too much work for you?

Best regards and thanks again! :-bd ^:)^

Posted

Re: SWR Grid EA

 

I will try, but not promise because I'm just an intermediate programmer.

 

If I can't I should or you should ask some good programmer here like bbrain or Hacker

 

I will do my best to look at it as soon as possible.

 

Best wishes,

a New Year 2011 has come, and the challenge has just started 8-)
Posted

Re: SWR Grid EA

 

Hi bro scarface,

thank you very much! :) It works on my demo account with 4-digit broker but not on my demo account with 5-digit broker. :?: Could you have a look again to solve the 5-digit problem (or maybe it is another reason?) if it is not too much work for you?

Best regards and thanks again! :-bd ^:)^

 

 

Have not tested it but should work on either four or five digit broker.

Would be nice if you would supply the user manual so it can be programmed easier.

 

Hit the Kudo Button for a thank you.

 

///////////////////////////////////////////////////////

 

//+------------------------------------------------------------------+

#property copyright "Copyright © 2009"

#property link ""

 

//---- input parameters

#include <WinUser32.mqh>

//========================

 

extern string Broker = "------Broker Five or Four Digit------";

extern bool FiveDigitsBroker = true;

 

//========================

 

 

int magic=1;

extern int TargetBalance=10000000;

extern int JamMulaiTrade=13;

extern int JamSelesaiTrade=20;

extern int MaxSpread=10; //cuma berlaku di level 1, kalau dilevel berikutnya harus tetap open walaupun spreadnya segedhe gajah....mau loss?

extern int Slippage=3;

extern double initial_lot=0.1;

extern int grid_level=10;

extern int range=20;

extern double multiplier=2;

extern bool EquityProfitClose=true;

extern double HowManyBucks=100;

extern int TakeProfit=10;

extern string note=".: Parameter Indikator :.";

extern bool UseMA = false;

extern int PeriodMA=5;

extern string note_0="MA Method: 0=Simple, 1=Exponential, 2=Smoothed, 3=Linear Weighted";

extern int maMethod=1;

extern bool UseBollinger=true;

extern int PeriodsBB=20;

extern int Shift=0;

extern int Deviations=2;

extern bool UseStochastic=true;

extern int Kperiod=5;

extern int Dperiod=3;

extern int Slowing=3;

extern string oo="PriceField.. 0= Low/High , 1=Close/Close";

extern int PriceField=0;

extern int StochMAMethod=0;

extern int HighStoch=85;

extern int LowStoch=15;

int prec, jumlah, hitung;

double /*pt,*/ minlot, maxlot, startbalance;

double _g_point;

 

 

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

_g_point = Point;

if(FiveDigitsBroker)

{

if(Digits==4 || Digits==2)

if(MessageBox("You selected 5 digits broker but it seems to be 4 digits one! Please change FiveDigitsBroker = true to false. \nContinue?","Question", MB_YESNO|MB_ICONQUESTION)==IDNO) return(0);

_g_point = Point*10;

Print("Platform Point is ", Point,"; we are using ",_g_point);

}

 

//----

/*if(Digits<4) pt=0.01;

else pt=0.0001;*/

minlot=MarketInfo(Symbol(), MODE_MINLOT);

maxlot=MarketInfo(Symbol(), MODE_MAXLOT);

if(minlot==0.01) prec=2;

else if(minlot==0.1) prec=1;

else prec=0;

startbalance=AccountBalance();

Comment("");

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

 

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

if(AccountBalance()>TargetBalance)

{

closeall();

Comment("\nTARGET BALANCE IS REACHED !!!");

return(0);

}

//----

if(EquityProfitClose && AccountEquity()>startbalance+HowManyBucks)

{

if(closeall()>0 && jumlah()==0) startbalance=AccountBalance();

}

//----

int tutup=0;

if(OrdersTotal()>0)

{

for(hitung=0; hitung<OrdersTotal(); hitung++)

{

OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()!=Symbol()) continue;

if(OrderComment()=="main order")

{

if(OrderType()==OP_BUY)

{

if(Bid>OrderOpenPrice()+TakeProfit*_g_point)

{

tutup++;

}

}

if(OrderType()==OP_SELL)

{

if(Ask<OrderOpenPrice()-TakeProfit*_g_point)

{

tutup++;

}

}

}

}

}

if(tutup>0) closeall();

//----

if(TimeHour(TimeCurrent())>=JamSelesaiTrade || TimeHour(TimeCurrent())<JamMulaiTrade)

{

Comment("\nBelum waktunya trading....");

return(0);

}

Comment("");

//----

double ma1=iMA(Symbol(),0,PeriodMA,0,maMethod,PRICE_CLOSE,1);

double ma2=iMA(Symbol(),0,PeriodMA,0,maMethod,PRICE_OPEN,1);

double bb1=iCustom(Symbol(),0,"Bands",PeriodsBB,Shift,Deviations,1,0);

double bb2=iCustom(Symbol(),0,"Bands",PeriodsBB,Shift,Deviations,2,0);

double stoch=iStochastic(Symbol(),0,Kperiod,Dperiod,Slowing,PriceField,StochMAMethod,MODE_SIGNAL,0);

//----

int BUY=0, SELL=0, Buy=0, Sell=0, buy=0, sell=0;

if(ma1>ma2) BUY++;

if(ma1<ma2) SELL++;

if(Close[0]<bb2) Buy++;

if(Close[0]>bb1) Sell++;

if(stoch<LowStoch) buy++;

if(stoch>HighStoch) sell++;

bool long, short;

if(UseMA && !UseBollinger && !UseStochastic)

{

if(BUY>0) long=TRUE;

else long=FALSE;

if(SELL>0) short=TRUE;

else short=FALSE;

}

if(!UseMA && UseBollinger && !UseStochastic)

{

if(Buy>0) long=TRUE;

else long=FALSE;

if(Sell>0) short=TRUE;

else short=FALSE;

}

if(!UseMA && !UseBollinger && UseStochastic)

{

if(buy>0) long=TRUE;

else long=FALSE;

if(sell>0) short=TRUE;

else short=FALSE;

}

if(UseMA && UseBollinger && !UseStochastic)

{

if(BUY>0 && Buy>0) long=TRUE;

else long=FALSE;

if(SELL>0 && Sell>0) short=TRUE;

else short=FALSE;

}

if(!UseMA && UseBollinger && UseStochastic)

{

if(Buy>0 && buy>0) long=TRUE;

else long=FALSE;

if(Sell>0 && sell>0) short=TRUE;

else short=FALSE;

}

if(UseMA && !UseBollinger && UseStochastic)

{

if(BUY>0 && buy>0) long=TRUE;

else long=FALSE;

if(SELL>0 && sell>0) short=TRUE;

else short=FALSE;

}

if(UseMA && UseBollinger && UseStochastic)

{

if(BUY>0 && Buy>0 && buy>0) long=TRUE;

else long=FALSE;

if(SELL>0 && Sell>0 && sell>0) short=TRUE;

else short=FALSE;

}

if(!UseMA && !UseBollinger && !UseStochastic)

{

Comment("\nPakai minimal 1 indicator !!............",

"\nSoalnya ga bisa trading tanpa indicator.");

return(0);

}

//----

if(jumlah()==0)

{

if(long==TRUE && MarketInfo(Symbol(), MODE_SPREAD)<MaxSpread) {if(sendorder(0,initial_lot,magic, "main order")) return(0);}

if(short==TRUE && MarketInfo(Symbol(), MODE_SPREAD)<MaxSpread) {if(sendorder(1,initial_lot,magic, "main order")) return(0);}

}

double op=0,lot=0;

int type=-1;

if(jumlah()>0 && jumlah()<grid_level)

{

for(hitung=0; hitung<OrdersTotal(); hitung++)

{

if(!OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES)) break;

if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic) continue;

op=OrderOpenPrice();

type=OrderType();

lot=OrderLots();

}

if(type==0)

{

if(Ask<op-range*_g_point) {if(sendorder(0, NormalizeDouble(lot*multiplier, prec), magic, "grid")) return(0);}

}

if(type==1)

{

if(Bid>op+range*_g_point) {if(sendorder(1, NormalizeDouble(lot*multiplier, prec), magic, "grid")) return(0);}

}

}

return(0);

}

//+------------------------------------------------------------------+

int jumlah()

{

jumlah=0;

for(hitung=0; hitung<OrdersTotal(); hitung++)

{

OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=magic) continue;

jumlah++;

}

return(jumlah);

}

//+------------------------------------------------------------------+

bool sendorder(int cmd, double mylot, int orderID, string cmnt)

{

double LOT=0;

if(mylot<minlot) LOT=minlot;

else if(mylot>maxlot) LOT=maxlot;

else LOT=mylot;

if(cmd==0)

{

if(OrderSend(Symbol(), 0, LOT, Ask, Slippage, 0, 0, cmnt, orderID, 0, Blue)>0) return(true);

if(GetLastError()==138) RefreshRates();

}

if(cmd==1)

{

if(OrderSend(Symbol(), 1, LOT, Bid, Slippage, 0, 0, cmnt, orderID, 0, Red)>0) return(true);

if(GetLastError()==138) RefreshRates();

}

return(false);

}

//+------------------------------------------------------------------+

int closeall()

{

int tutup=0;

for(hitung=OrdersTotal()-1; hitung>=0; hitung--)

{

if(!OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES)) break;

if(OrderSymbol()!=Symbol()) continue;

if(OrderMagicNumber()==magic)

{

if(OrderType()==OP_BUY)

{

if(OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Magenta)) tutup++;

}

if(OrderType()==OP_SELL)

{

if(OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Magenta)) tutup++;

}

}

}

return(tutup);

}

 

//////////////////////////////////////////////

Posted

Re: SWR Grid EA

 

thank you very much! :) It works on my demo account with 4-digit broker but not on my demo account with 5-digit broker. :?: Could you have a look again to solve the 5-digit problem (or maybe it is another reason?) if it is not too much work for you?

Best regards and thanks again! :-bd ^:)^

 

 

Forwarded the file you need via e-mail

Enjoy

Posted

Re: SWR Grid EA

 

i found it works best on 1hour timeframe. 10k, default settings.

 

martingale + big drawdown though.

"It is inconceivable that anyone will divulge a truly effective get-rich scheme for the price of a book."

Victor Niederhoffer (1943–), US hedge fund manager and statistician

Posted

Re: SWR Grid EA

 

Hi guys,

 

Thanks for helping out, and sorry for being late to reply.

 

I checked it as well, and now I put it on forward testing on 5 digit-broker so it is working well.

 

I hope that is useful.

 

P.S. if your broker doesn't have micro accounts, change the Multiplier to 2.

 

Best wishes,

a New Year 2011 has come, and the challenge has just started 8-)
Posted

Re: SWR Grid EA

 

i used the code pheniox posted on this thread. create a mq4 file (even in notepad) copy it in and try that.

"It is inconceivable that anyone will divulge a truly effective get-rich scheme for the price of a book."

Victor Niederhoffer (1943–), US hedge fund manager and statistician

Posted

Re: SWR Grid EA

 

Hi folks,

once again. :P Do you think that it is possible to add a newsfilter to the EA? Is somebody able to do that? :?: I think that this would have a positive affect on the results and to reduce the large drawdowns on some days.

Best regards!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...