Saturday 19 January 2013


Coding asli :



#property copyright "Copyright © 2009, ChandraWG" 
#property link "www.chandrawiharja.com"

//tambahan filter ordercoment , magicnumber dan suport 5 digit broker(by Gathot007)
extern string continu="::>Bila false berhenti Op baru";
extern bool Continu_trade=true;
extern string Seting_time="::>Sesuai Jam broker";
extern int  StartHour =0;
extern int  StopHour =24;
extern int SL=35,TP=120;
extern double Lots=0.1;
extern int MaxReverse=5;
extern int Pereode_MA=10;
extern int Magic=7;
extern string Coment_EA="Gath_007";
double dpt;

int init()
{
   if(Digits==3 || Digits==5) dpt=10*Point;
   else                          dpt=Point;
}
int start()
{
label();
double tp2=(SL+TP)*dpt;
int ticket;
if (tot()==0 && Continu_trade && dTime()==1)
      {
         if (iClose(Symbol(),0,1) > iMA(Symbol(),0,Pereode_MA,0,MODE_EMA,PRICE_CLOSE,1))
         {
            OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,Coment_EA,Magic,0,Blue);
         }
         else if (iClose(Symbol(),0,1) < iMA(Symbol(),0,Pereode_MA,0,MODE_EMA,PRICE_CLOSE,1))
         {
            OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,Coment_EA,Magic,0,Red);
         }
         
      } 
if(tot()>0)
   {
      if(OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES))
      {
      if((OrderStopLoss()==0)&&(OrderSymbol()==Symbol()&& OrderComment()==Coment_EA))
         {
            if(OrderType()==0) 
               {
               ticket=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-SL*dpt,OrderOpenPrice()+TP*dpt,0);
               if (ticket<1) Print("Error Modify Buy order : ",GetLastError()); 
               return (0);
               }
            else if(OrderType()==1) 
               {
               ticket=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+SL*dpt,OrderOpenPrice()-TP*dpt,0);
               if (ticket<1) Print("Error Modify Sell order : ",GetLastError()); 
               return (0);
               }
            else return (0);
         }
      else if((dMagic()<Magic+MaxReverse)&&(OrderSymbol()==Symbol()&& OrderComment()==Coment_EA))
         {         
         if(OrderType()==0) 
            {
            ticket=OrderSend(Symbol(),OP_SELLSTOP,OrderLots()*2,OrderOpenPrice()-SL*dpt,0,OrderOpenPrice(),OrderOpenPrice()-tp2,Coment_EA,dMagic()+1,0,White);
            if (ticket<1) Print("Error opening SELLSTOP order : ",GetLastError()); 
            return (0);
            }
         else if(OrderType()==1) 
            {
            ticket=OrderSend(Symbol(),OP_BUYSTOP,OrderLots()*2,OrderOpenPrice()+SL*dpt,0,OrderOpenPrice(),OrderOpenPrice()+tp2,Coment_EA,dMagic()+1,0,Yellow);
            if (ticket<1) Print("Error opening BUYSTOP order : ",GetLastError()); 
            return (0);
            }
         else if((OrderType()>1)&&(tot()==1)) 
            {
            ticket=OrderDelete(OrderTicket(),0);
            if (ticket<1) Print("Error Deleted order : ",GetLastError()); 
            return (0);
            }
         else return (0);
         }
      else if((OrderType()>1)&&(tot()==1)) 
         {
         ticket=OrderDelete(OrderTicket(),0);
         if (ticket<1) Print("Error Deleted order : ",GetLastError()); 
         return (0);
         }
      else return (0);         
      }
      else Print("Error Select Order : ",GetLastError());
   }
return (0);
}
int tot()
{
  int too=0;
  for(int i=0; i<OrdersTotal(); i++)
  {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()!=Symbol() || OrderComment()!=Coment_EA) continue;
      too++;
  }
  return(too);
}
int dMagic()
{
  int too=0;
  for(int i=0; i<OrdersTotal(); i++)
  {
      OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()!=Symbol()&& OrderComment()==Coment_EA ) continue;
       too=OrderMagicNumber();
  }
  return(too);
}
void label()
{
             Comment(" ::::::::::::::::::::::::::::::::::::::::::::::::::", 
              "\n + Jam Broker             :",Hour(),":",Minute(), 
              "\n + Spread                 : ", MarketInfo(Symbol(), MODE_SPREAD), 
              "\n + Leverage               : 1 : ", AccountLeverage(), 
              "\n + Balance                : ", AccountBalance(), 
              "\n + Equity                 : ", AccountEquity(), 
              "\n + Lots                   :",Lots,
              "\n + SL                     :",SL,
              "\n + TP                     :",TP,
              "\n + MaxReverse             :",MaxReverse,
              "\n + Level saat ini         :",dMagic()-Magic,
              "\n + Waktu Trade Jam        : ", StartHour,": s/d :", StopHour, 
              "\n ::::::::::::::::::::::::::::::::::::::::::::::::::");
}
 int dTime() {
   bool trade = FALSE;
   if(StartHour>StopHour){
     if (TimeHour(TimeCurrent()) >= StartHour || TimeHour(TimeCurrent()) < StopHour) trade = TRUE;
   } else
     if (TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < StopHour) trade = TRUE;
   return (trade);
}


==================================


modiv menjadi :

#property copyright "Copyright © 2009, ChandraWG"
#property link "www.chandrawiharja.com"


//tambahan filter ordercoment , magicnumber dan suport 5 digit broker(by Gathot007) 

extern string continu="::>Bila false berhenti Op baru"

extern bool Continu_trade=true

extern string Seting_time="::>Sesuai Jam broker"

extern int  StartHour =0

extern int  StopHour =24

extern int SL=35,TP=120

extern double Lots=0.1

extern int MaxReverse=5

extern int Pereode_MA=10

extern int Magic=7

extern string Coment_EA="Gath_007"

double dpt

extern int dailymax=1;  // penambahan di sini 

int day=-1,daily=0

int init() 



{
   if(
Digits==|| Digits==5dpt=10*Point;
   else                          
dpt=Point;
 
 
int start()
label(); double tp2=(SL+TP)*dptint ticket;
if  (
day!=Day())  {daily=0;}

if (
tot()==&& Continu_trade && dTime()==1&&  daily dailymax )
      {
         if (
iClose(Symbol(),0,1) > iMA(Symbol(),0,Pereode_MA,0,MODE_EMA,PRICE_CLOSE,1))
         {
            
OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,Coment_EA,Magic,0,Blue);
            
day=Day(); daily++;
         }
         else if (
iClose(Symbol(),0,1) < iMA(Symbol(),0,Pereode_MA,0,MODE_EMA,PRICE_CLOSE,1))
         {
            
OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,Coment_EA,Magic,0,Red);
             
day=Day(); daily++;
         }
       
      }
if(
tot()>0)
   {
      if(
OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES))
      {
      if((
OrderStopLoss()==0)&&(OrderSymbol()==Symbol()&& OrderComment()==Coment_EA))
         {
            if(
OrderType()==0)
               {
               
ticket=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-SL*dpt,OrderOpenPrice()+TP*dpt,0);
               if (
ticket<1) Print("Error Modify Buy order : ",GetLastError());
               return (
0);
               }
            else if(
OrderType()==1)
               {
               
ticket=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+SL*dpt,OrderOpenPrice()-TP*dpt,0);
               if (
ticket<1) Print("Error Modify Sell order : ",GetLastError());
               return (
0);
               }
            else return (
0);
         }
      else if((
dMagic()<Magic+MaxReverse)&&(OrderSymbol()==Symbol()&& OrderComment()==Coment_EA))
         {       
         if(
OrderType()==0)
            {
            
ticket=OrderSend(Symbol(),OP_SELLSTOP,OrderLots()*2,OrderOpenPrice()-SL*dpt,0,OrderOpenPrice(),OrderOpenPrice()-tp2,Coment_EA,dMagic()+1,0,White);
            if (
ticket<1) Print("Error opening SELLSTOP order : ",GetLastError());
            return (
0);
            }
         else if(
OrderType()==1)
            {
            
ticket=OrderSend(Symbol(),OP_BUYSTOP,OrderLots()*2,OrderOpenPrice()+SL*dpt,0,OrderOpenPrice(),OrderOpenPrice()+tp2,Coment_EA,dMagic()+1,0,Yellow);
            if (
ticket<1) Print("Error opening BUYSTOP order : ",GetLastError());
            return (
0);
            }
         else if((
OrderType()>1)&&(tot()==1))
            {
            
ticket=OrderDelete(OrderTicket(),0);
            if (
ticket<1) Print("Error Deleted order : ",GetLastError());
            return (
0);
            }
         else return (
0);
         }
      else if((
OrderType()>1)&&(tot()==1))
         {
         
ticket=OrderDelete(OrderTicket(),0);
         if (
ticket<1) Print("Error Deleted order : ",GetLastError());
         return (
0);
         }
      else return (
0);       
      }
      else Print(
"Error Select Order : ",GetLastError());
   }
return (
0);
int tot()
{
  
int too=0;
  for(
int i=0i<OrdersTotal(); i++)
  {
      
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
OrderSymbol()!=Symbol() || OrderComment()!=Coment_EA) continue;
      
too++;
  }
  return(
too);
int dMagic()
{
  
int too=0;
  for(
int i=0i<OrdersTotal(); i++)
  {
      
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(
OrderSymbol()!=Symbol()&& OrderComment()==Coment_EA ) continue;
       
too=OrderMagicNumber();
  }
  return(
too);
void label()
{
             
Comment(" ::::::::::::::::::::::::::::::::::::::::::::::::::",
              
"\n + Jam Broker             :",Hour(),":",Minute(),
              
"\n + Spread                 : "MarketInfo(Symbol(), MODE_SPREAD),
              
"\n + Leverage               : 1 : "AccountLeverage(),
              
"\n + Balance                : "AccountBalance(),
              
"\n + Equity                 : "AccountEquity(),
              
"\n + Lots                   :",Lots,
              
"\n + SL                     :",SL,
              
"\n + TP                     :",TP,
              
"\n + MaxReverse             :",MaxReverse,
              
"\n + Level saat ini         :",dMagic()-Magic,
              
"\n + Waktu Trade Jam        : "StartHour,": s/d :"StopHour,
              
"\n ::::::::::::::::::::::::::::::::::::::::::::::::::");
}
 
int dTime() {
   
bool trade FALSE;
   if(
StartHour>StopHour){
     if (
TimeHour(TimeCurrent()) >= StartHour || TimeHour(TimeCurrent()) < StopHourtrade TRUE;
   } else
     if (
TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < StopHourtrade TRUE;
   return (
trade);
}  

No comments:

Post a Comment