BTC USD 76,148.2 Gold USD 4,271.83
Time now: Jun 1, 12:00 AM

pending order pakai script

salam semua..baru lepas close aud/usd sell tadi.dr pagi tunggu..market lembab skt sekarang.sbb ada sesuatu impak besar akan berlaku..part tu yg saya nk tunggu.bukan sekarang,tp bila tiba masanya.hehehe..

nk focus pair mana tu masta?
 
script, indi dan expert all in one.

update martingale script
- script yang saya post sebelum ini akan ada masalah dengan broker yang menggunakan market execution. Normal broker guna instant execution, contoh broker yang mennggunakan market execution ialah ECN brokers

update modify target
- di tambah modify stoploss

update expert
- tambahan function match target

Test dulu sebelum guna live.
http://www.4shared.com/file/_diRLBfZ/manual_martingale.html
 
Bro Aiman, nnt free on nak tanya pasal DLL call function.. nak pakai API dari kernel32. tgk bro ada pakai user32.dll dalam FPI..

ni dah tahap advanced. Nak buat apa ni?
 
master coder, camne nak bg cepat close ye? sebab broker ke sebab cara codinng?

Code:
//+------------------------------------------------------------------+
//|                                            close-all-orders.mq4  |
//|                                       Copyright © 2009 Lukpayat  |
//|                                     www.OasisWealthBuilders.com  |
//+------------------------------------------------------------------+

#property copyright "Copyright © Oasis."
#property link      "www.oasiswealthbuilders.com"
#property show_confirm
int start()
{
  int total = OrdersTotal();
  for(int i=total-1;i>=0;i--)
  {
    OrderSelect(i, SELECT_BY_POS);
    int type   = OrderType();

    bool result = false;
    
    switch(type)
    {
     
      case OP_BUYLIMIT    : result = OrderDelete(OrderTicket());
                            break;
      case OP_SELLLIMIT    : result = OrderDelete(OrderTicket());
                             break;
      case OP_BUYSTOP      : result = OrderDelete(OrderTicket());
                           break;
       case OP_SELLSTOP      : result = OrderDelete(OrderTicket());   
                           break;   
                           
        //Close opened long positions
      case OP_BUY       : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
                          break;
      
      //Close opened short positions
      case OP_SELL      : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
                          break;              
    }
    
    if(result == false)
    {
      Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
      Sleep(3000);
    }  
  }
  
  return(0);
}
__________________
 
uikkkkkkkkkkkk cuba taruk arahan ni sikit..order ticket force when drawdown/sideway
 
script, indi dan expert all in one.

update martingale script
- script yang saya post sebelum ini akan ada masalah dengan broker yang menggunakan market execution. Normal broker guna instant execution, contoh broker yang mennggunakan market execution ialah ECN brokers

update modify target
- di tambah modify stoploss

update expert
- tambahan function match target

Test dulu sebelum guna live.
http://www.4shared.com/file/_diRLBfZ/manual_martingale.html

firstly thanks bebanyak kpd bro aiman..tapi nk report 1 bnda lg ni..kenapa EA tu adjust TP jadi 0.0000 smuanya eh?
 
salam....boleh tak otai otai kat cni settingkan skrip untuk sel dan buy secara serentak dan pending order dalam 100
harap dapat membantu otai....
 
salam....boleh tak otai otai kat cni settingkan skrip untuk sel dan buy secara serentak dan pending order dalam 100
harap dapat membantu otai....

Code:
#property copyright "Aiman."
#property show_inputs
#include <stdlib.mqh>

extern bool    use_timer   = false;
extern string  timer       = "08:30";
extern double  Lots        = 0.01;
extern int     Pips        = 150;
extern int     StopLoss    = 100;      
extern int     TakeProfit  = 500;
extern bool    Buy_Stop    = true;
extern bool    Sell_Stop   = true;
extern bool    Buy_Limit   = false;
extern bool    Sell_Limit  = false;

       int     Slippage    = NULL;
       
double bid,ask;

int deinit ()
{
   Comment ("");
   return (0);
}
   
int start()
{
   if (use_timer) countdown ();
   else
   {
      bid=Bid;
      ask=Ask;
      if (Buy_Stop)   PO_order(OP_BUYSTOP);
      if (Sell_Stop)  PO_order(OP_SELLSTOP);
      if (Buy_Limit)  PO_order(OP_BUYLIMIT);
      if (Sell_Limit) PO_order(OP_SELLLIMIT);
   }
   return(0);
}

void PO_order (int PO_type)
{
   int err;
   double PO,SL,TP;
   string comment;
   
   if (PO_type==OP_BUYSTOP)
   {
      comment  ="Placing BuyStop = ";
      PO       =ask+Pips*Point;
      if (StopLoss>0)   SL=ask-(StopLoss*Point)+Pips*Point; else SL=0;
      if (TakeProfit>0) TP=bid+(TakeProfit*Point)+Pips*Point; else TP=0;     
   }

   if (PO_type==OP_SELLSTOP)
   {
      comment  ="Placing SellStop = ";
      PO       =bid-Pips*Point;
      if (StopLoss>0)   SL=bid+(StopLoss*Point)-Pips*Point; else SL=0;
      if (TakeProfit>0) TP=ask-(TakeProfit*Point)-Pips*Point; else TP=0;      
   }
   
   if (PO_type==OP_BUYLIMIT)
   {
      comment  ="Placing BuyLimit = ";
      PO       =ask-Pips*Point;
      if (StopLoss>0)   SL=ask-(StopLoss*Point)-Pips*Point; else SL=0;
      if (TakeProfit>0) TP=bid+(TakeProfit*Point)-Pips*Point; else TP=0;
   }

   if (PO_type==OP_SELLLIMIT)
   {
      comment  ="Placing SellLimit = ";
      PO       =bid+Pips*Point;
      if (StopLoss>0)   SL=bid+(StopLoss*Point)+Pips*Point; else SL=0;
      if (TakeProfit>0) TP=ask-(TakeProfit*Point)+Pips*Point; else TP=0;
   }

   bool loop=true;
   int cnt=0;
   while(loop)
   {
      OrderSend(Symbol(),PO_type,Lots,PO,Slippage,SL,TP,"",0,0,CLR_NONE);
      err=GetLastError();
      Print (comment, ErrorDescription(err));
      cnt++;
      if (cnt>20 || err==0) loop = false;
      Sleep(50);
   }
   if (err>0) Print (comment+ErrorDescription(err));
}

void countdown ()
{
   string rotate []={" /"," -"," \\"," |"},textComment;
   int i;
   bool loop=true;
  
   while (loop)
   {
      i++; if (i>=3) i=0;
      
      textComment = StringConcatenate(rotate[i]," SCRIPT IS ACTIVE ",rotate[i],"\n",
                    "Current Time = ",TimeToStr(TimeLocal(), TIME_SECONDS),"\n",
                    "Execute Time = ",timer,
                    "\n\nPending Order to be executed: ");
                    
      if (Buy_Stop) textComment=textComment+"\nBuy Stop";
      if (Sell_Stop) textComment=textComment+"\nSell Stop";
      if (Buy_Limit) textComment=textComment+"\nBuy Limit";
      if (Sell_Limit) textComment=textComment+"\nSell Limit";
      
      textComment=textComment+"\n\nSettings:\nLots : "+DoubleToStr(Lots,2);  
      textComment=textComment+"\nPips : "+DoubleToStr(Pips,0); 
      textComment=textComment+"\nStopLoss : "+DoubleToStr(StopLoss,0); 
      textComment=textComment+"\nTakeProfit : "+DoubleToStr(TakeProfit,0);  
   
      if (TimeLocal()==StrToTime(timer)) loop=false;
      Sleep (1000);
      Comment (textComment);
   }
   
   use_timer=false;   
   Comment ("SENDING PENDING ORDER...");
   start();
}
 
firstly thanks bebanyak kpd bro aiman..tapi nk report 1 bnda lg ni..kenapa EA tu adjust TP jadi 0.0000 smuanya eh?

Cuba cari code bawah ni, adjust kaler merah. next week bro test balik

Code:
if (OrderType()==OP_BUY)
         if (OrderTakeProfit()!=0)
         {
            if (buyTP[COLOR="Red"]==[/COLOR]0) buyTP=OrderTakeProfit();
            else          buyTP=[COLOR="red"]MathMin[/COLOR](buyTP,OrderTakeProfit());
         }
      if (OrderType()==OP_SELL)
         if (OrderTakeProfit()!=0)
         {
            if (sellTP[COLOR="red"]==[/COLOR]0) sellTP=OrderTakeProfit();
            else           sellTP=[COLOR="red"]MathMax[/COLOR](sellTP,OrderTakeProfit());
         }
 

Live Forex Chart

Currency
Rates
EUR / USD
1.14683
USD / JPY
156.047
GBP / USD
1.33728
USD / CHF
0.82541
USD / CAD
1.39894
EUR / JPY
178.959
AUD / USD
0.70887
Back
Top
Log in Register