Thursday, 10 January 2013

EA berdasarkan volume candle

logic BUY:
1.apabila candle pertama di TF 15 M ditutup di atas, dengan range minimal 30 point.
2.lalu buka candle berikutnya, naik 10 point langsung ambil posisi BUY.


logic SELL:
1.apabila candle pertama di TF 15 M ditutup di bawah, dengan range minimal 30 point.
2.lalu buka candle berikutnya, turun 10 point langsung ambil posisi SELL.

stop loss : 30 point
taking profit : 100 point
trailing stopnya : 20 point

NB: klo bisa, SL,TP,dan TS ( TrailingStop) nya di hidden.
dan jam tradingnya mulai jam 9.15 wita - 12.00 wita & dilanjutkan lagi trading jam 13.00 wita - 16.15 wita.

mohon bantuan revisi dan edit dari teman2 master yang mengerti MQL4.



//+------------------------------------------------------------------+
//| Belajar2.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

extern double Lots = 0.1;
extern bool use_hidden_TakeProfit = true;
extern int hidden_TakeProfit = 100;
extern bool use_hidden_StopLoss = true;
extern int hidden_Stoploss = 30 ;
extern int TrailingStop = 20 ;
extern int Magic = 12345;
extern int Slippage = 5;


//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----

if (iClose(Symbol (),0,1)>iOpen(Symbol(),0,1)&& iClose(Symbol(),0,1)-iOpen(Symbol(),0,1)<=20*Point)
{OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-hidden_Stoploss*Point,Ask+hidden_TakeProfit*Point, "Belajar2",Magic,0,Blue);}

else if (iClose(Symbol (),0,1)<iOpen(Symbol(),0,1)&& iOpen(Symbol(),0,1)-iClose(Symbol(),0,1)<=20*Point)
{OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+ hidden_Stoploss*Point,Bid-hidden_TakeProfit*Point,"Belajar2",Magic,0,Red);}

if( OrderSelect(12345,SELECT_BY_TICKET) && OrderCloseTime()==0 ) {
if( OrderType()==OP_BUY ) {
OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]-Point*TrailingStop,OrderTakeProfit(),0);
}
else if( OrderType()==OP_SELL ) {
OrderModify(OrderTicket(),OrderOpenPrice(),Open[0]+Point*TrailingStop,OrderTakeProfit(),0);
}
}

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