BTC USD 64,283.2 Gold USD 4,481.21
Time now: Jun 1, 12:00 AM

Forex King Scalper (EA)

anTu7869

Active Member
Messages
1,322
Joined
Jan 8, 2008
Messages
1,322
Reaction score
232
Points
33
Salam...

Untuk tidak dikatakan mengganggu/hijack thread tuan Alieyfx, aku bukak la thread special utk teknik dia. Credit utk encik Aliefx... :)cgrock

Link encik Aliefx
http://carigold.com/portal/forums/showthread.php?t=135019

Atas permintaan, aku share secara PERCUMA EA yang 'mungkin' seakan2 teknik encik Aliefx tersebut. Macam biasa la kan... TAYOR!!! :)paid:)paid:)paid

Nanti kalo ada teknikal error ke hape ke pasal EA nih leh le kita discuss kat sini jek... Kat tempat Aliefx tu tempat utk discuss teknik2... :D

Rajin2 la tekan button Thanks tu ek? huhuhu... :)):)):)) Nanti, kalo dah untung leh la share popit tu ngan aku plak... huhuhu...:)):)):))

p/s: saje je takmo bagi fail mq4 bulat2... copy paste sendiri... kita sesama belaja... :D
 
Fail EA

Copy&Paste sume2 kat bawah nih sebagai fail *.mq4... Sukati korang la nak letak nama apa kat tanda '*' tuh... :D

mungkin ada error sbb ada spaces " ". rapat2kan lik pastu compile... GOOD LUCK!!! :)cgrock:)cgrock:)cgrock

Code:
[COLOR="Blue"]//------------------
#property copyright ""
#property link      ""
#include <stdlib.mqh>

extern double InitialLot=0.1;
extern int TP=15;
extern int SL=15;
extern bool UseMultiplyLot=true;
extern int LotMultiplier=2;
extern bool UseDailyTarget=true;
extern double DailyTarget=30; //usd
extern int MinuteAssignHiLo=15;
extern int MinuteResetHiLo=55;
extern int MinuteStart=15;
extern int MinuteFinish=54;
extern int PipDifferentLow=1;
extern int PipDifferentHigh=2;
extern bool UseTimeRange=true;
extern int HoursStartTrade=09;
extern int MinuteStartTrade=00;
extern int HoursFinishTrade=17;
extern int MinuteFinishTrade=59;
extern bool UseBasketProfit=false;
extern double BasketProfit=10;
extern double BasketLoss=15;
double high15=0;
double low15=0;
int HourDone[24];
string mySymbol;
double tempTimeStartTrade, tempTimeFinishTrade, tempCurrentTime;
double Slippage=2;
string TradeComment="TF15 HiLo Scalping";
int MagicNumber=12345678;
double ask, bid, point, tempLot, TargetAccountBalance, tempTargetAccountBalance;


// user input
int init()
  {
  if (UseTimeRange==true)
   {
   tempTimeStartTrade=(HoursStartTrade*100)+MinuteStartTrade;
   tempTimeFinishTrade=(HoursFinishTrade*100)+MinuteFinishTrade;
   } 
  
  if (UseDailyTarget==true)
  {TargetAccountBalance=AccountBalance()+DailyTarget;}  
 
  
  for (int cv=0; cv<24; cv++) HourDone[cv]=false; //initiate
  
  tempLot=InitialLot; 
  
  
  mySymbol=Symbol();  
  
   Print("Init happened ",Hour()+":"+Minute());
   Comment("EA Scalping");
  }


//+----------------+
//| Custom DE-init |
//+----------------+
// Called ONCE when EA is removed from chart

int deinit()
  {
     
   Print("DE-Init happened ",Hour()+":"+Minute());
   Comment("");
  }



int start()
  {   

   tempTargetAccountBalance=TargetAccountBalance; 
   if (Hour()==00 && Minute()==00)
   {
   TargetAccountBalance=0;
   if (UseDailyTarget==true)
      {TargetAccountBalance=AccountBalance()+DailyTarget;}  
   for (int cv=0; cv<24; cv++) {HourDone[cv]=false;} //initiate
   Comment("EA reset at "+Hour()+":"+Minute()+". Previous target="+DoubleToStr(tempTargetAccountBalance,2));
   return;
   }  
   
   if ( (UseBasketProfit==true) && OrdersTotal()>0 ) FunctionBasketProfit();
   
   if (UseDailyTarget==true)
   {
   if (AccountBalance()>=TargetAccountBalance) 
   { Comment("Daily target achieved! Final Total USD"+DoubleToStr(AccountBalance(),2)); return;}
   }    
   
   
   if (UseTimeRange==true && TradeTime()==false) {Comment("EA is OFF... NOT trade time");return;}             

   if (HourDone[Hour()]==true || OrdersTotal()>0 ) return;
    
   //assign high and low
   if (Minute()==MinuteAssignHiLo)
   {
   high15=iHigh(mySymbol,15,1);
   low15=iLow(mySymbol,15,1);  
   }
   
   
   if (Minute()==MinuteResetHiLo) { high15=0; low15=0;}
   
   Comment("Hour:"+Hour()+", High 0-15 = "+DoubleToStr(high15,4)+", Low 0-15="+DoubleToStr(low15,4)+"/Closing target=USD"+DoubleToStr(TargetAccountBalance,2));
   
   if (Minute()>=MinuteStart && Minute()<=MinuteFinish &&
       HourDone[Hour()]==false)
       {
        if (Bid>=high15+(PipDifferentLow*point) && Bid<=high15+(PipDifferentHigh*point))
                      {
                       if (UseMultiplyLot==true) {CheckHitTP_SL();}                       
                       OpenPos("Buy", InitialLot);
                       HourDone[Hour()]=true;
                       high15=0; low15=0; //reset hilo
                       Comment("Open position for Hour ="+Hour()+" is done. Closing target=USD"+DoubleToStr(TargetAccountBalance,2));
                       InitialLot=tempLot;                                                                 
                      }
        if (Ask<=low15-(PipDifferentLow*point) && Ask>=low15-(PipDifferentHigh*point)) 
                      {
                       if (UseMultiplyLot==true) {CheckHitTP_SL();}                       
                       OpenPos("Sell", InitialLot);
                       HourDone[Hour()]=true;                                  
                       high15=0; low15=0;//reset hilo
                       Comment("Open position for Hour ="+Hour()+" is done. Closing target=USD"+DoubleToStr(TargetAccountBalance,2));
                       InitialLot=tempLot;
                      }        
       }       


return;


  } // start()

//check last closed position for multiply lots  
void CheckHitTP_SL()
{
if (OrdersHistoryTotal()==0) return;
OrderSelect(OrdersHistoryTotal()-1, SELECT_BY_POS, MODE_HISTORY);
if (OrderProfit()>0) {InitialLot=tempLot;}
if (OrderProfit()<0) {InitialLot=OrderLots()*LotMultiplier;}

return;
}
  
void OpenPos(string Trade, double Lots)
{
int gle=0;
int ticket=0;

int loopcount;

loopcount=0;
bid=MarketInfo(mySymbol,MODE_BID);
ask=MarketInfo(mySymbol,MODE_ASK);
point=MarketInfo(mySymbol,MODE_POINT);

double TPBuy=0;
double SLBuy=0;
double TPSell=0;
double SLSell=0;

if(TP>0){TPBuy=ask+TP*point;TPSell=bid-TP*point;}
if(SL>0){SLBuy=ask-SL*point;SLSell=bid+SL*point;}

while(true) 
{



if (Trade=="Buy") 
   { ticket=OrderSend(mySymbol,OP_BUY,Lots,Ask,Slippage ,SLBuy,TPBuy,TradeComment,MagicNumber ,White);
    }
   
if (Trade=="Sell") 
   { ticket=OrderSend(mySymbol,OP_SELL,Lots,Bid,Slippage,SLSell,TPSell,TradeComment,MagicNumber,Red); 
    }

gle=GetLastError();
if(gle==0)
{
if (Trade=="Buy") Print("BUY PLACED Ticket="+ticket+" Ask="+ask+" Lots="+Lots); 
if (Trade=="Sell") Print("SELL PLACED Ticket="+ticket+" Bid="+bid+" Lots="+Lots); 
break;
}
else 
{ 
if (Trade=="Buy") Print("-----ERROR----- Placing BUY order: Lots="+Lots+" Bid="+bid+" Ask="+ask+" ticket="+ticket+" Err="+gle+" "+ErrorDescription(gle)); 
if (Trade=="Sell") Print("-----ERROR----- placing SELL order: Lots="+Lots+" SL="+" Bid="+bid+" Ask="+ask+" ticket="+ticket+" Err="+gle+" "+ErrorDescription(gle)); 
//RefreshRates();


// give up after 10 tries (~5 seconds)
loopcount++;
if(loopcount>1)
{
if (Trade=="Buy") Print("-----ERROR----- Giving up on placing BUY order"); 
if (Trade=="Sell") Print("-----ERROR----- Giving up on placing SELL order"); 
return(gle);
}
}
}
}//void OpenPos



bool TradeTime() 
{
tempCurrentTime=(Hour()*100)+Minute();


   if(tempTimeStartTrade<tempTimeFinishTrade)
   {  
        
      if   (tempCurrentTime>=tempTimeStartTrade && tempCurrentTime<=tempTimeFinishTrade)
            
         return(true);
   }   
   else if(tempTimeStartTrade>tempTimeFinishTrade)
   {
      if   (tempCurrentTime>=tempTimeStartTrade || tempCurrentTime<=tempTimeFinishTrade)  
            
      return(true);
   }
   
   return(false); 
}


int FunctionBasketProfit()
  {
   
   
   int    cnt;
   double myAsk;
   double myBid;      
   double   currBasket=0;

   //Basket profit or loss
   currBasket=AccountEquity()-AccountBalance();
   //Comment("Profit/Loss = ",currBasket);    
      
   if(currBasket>=BasketProfit || currBasket<=(BasketLoss*(-1)) )
     {
     // CLOSE order if profit target made
      
      while (OrdersTotal()>0) //enforce close all trade
      {
      for(cnt=OrdersTotal(); cnt>=0; cnt--)
        {
         OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);         
         if( OrderType()==OP_BUY || OrderType()==OP_SELL )
           {
            mySymbol=OrderSymbol();
 
            if(OrderType()==OP_BUY)
              {
               myBid=MarketInfo(mySymbol,MODE_BID);            
               OrderClose(OrderTicket(),OrderLots(),myBid,Slippage,White);
               
              } // if BUY


            if(OrderType()==OP_SELL)
              {
               myAsk=MarketInfo(mySymbol,MODE_ASK);            
               OrderClose(OrderTicket(),OrderLots(),myAsk,Slippage,Red);
               
              } //if SELL
           
           } // if(OrderSymbol)
        
        } // for
      }//while Ordertotal()>0
     } //currBasket
     
      
   
  } //  
//-----------[/COLOR]
 
Last edited:
ok bro.mari kite ngetest sama2.
 
tengkiu...

*ado skit2 silap kat script tu tapi bole dibetulkan
 
Last edited:
yg dinanti sudah tiba...apo laie...jom belasah cukup2:D...tq antu
 
WAHH dah realease yang baru yekk-- bagus-- terima kasih tt
 
mcm mn nk jd kan mq4 ni. den lagi x reti...
 
TT kasi jelah EA tu...aku compile ada error~X(...ceq bukan reti sgt neh

mcm mana leh error plak? aku copy sebijik2 ea tuh... takpe, belaja pelan2... apa error kuar? yg dah copy ada error tak? :D

p/s: sambil nyelam, kita skodeng... :D
 

Latest Posts

Live Forex Chart

Currency
Rates
EUR / USD
1.16096
USD / JPY
159.873
GBP / USD
1.34311
USD / CHF
0.79067
USD / CAD
1.39037
EUR / JPY
185.605
AUD / USD
0.71294
Back
Top
Log in Register