BTC USD 81,038.9 Gold USD 4,378.12
Time now: Jun 1, 12:00 AM

pending order pakai script

macam belajo buat ea plak, :)cgrock

nak tanyer sikit,,
macamana yerkk kalu kita nak set TP begini:

TP = perbezaan post pertama dgn post terakhir dibahagi dengan bilangan open post

bagaimana arahan yg sesuai yerk..

Thanks..

boleh untung ke macam ni?:-?
 
boleh untung ke macam ni?:-?

Sory bro aiman..
tersalah kiraan,
sebetulnya :
TP = perbezaan post pertama dgn post terakhir dibahagi dengan 2

Terima kasih banyak atas teguran masta... :)cgrock
 
Sory bro aiman..
tersalah kiraan,
sebetulnya :
TP = perbezaan post pertama dgn post terakhir dibahagi dengan 2

Terima kasih banyak atas teguran masta... :)cgrock

Bawah ni script.
Rasanya pakai be calculator kat sebelah lagi baik.
Code:
//+------------------------------------------------------------------+
//|                                                 Middle Price.mq4 |
//|                                          Copyright © 2010, Aiman |
//|                                                            Aiman |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Aiman"
#property link      "Aiman"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start ()
{
   double topBuy=0, botBuy, topSell=0, botSell, midBuy, midSell;
   for (int i=0; i<OrdersTotal(); i++)
   {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol()!=Symbol()) continue;
      if (OrderType()==OP_BUY)
      {
         if (topBuy==0) 
         {
            topBuy=OrderOpenPrice();
            botBuy=OrderOpenPrice();
         }
         else
         {
            topBuy=MathMax(topBuy,OrderOpenPrice());
            botBuy=MathMin(botBuy,OrderOpenPrice());
         }
      }
      if (OrderType()==OP_SELL)
      {
         if (topSell==0) 
         {
            topSell=OrderOpenPrice();
            botSell=OrderOpenPrice();
         }
         else
         {
            topSell=MathMax(topSell,OrderOpenPrice());
            botSell=MathMin(botSell,OrderOpenPrice());
         }
      }
   }
   if (topBuy!=0)  midBuy = (topBuy+botBuy)/2;
   if (topSell!=0) midSell= (topSell+botSell)/2;
   
   Comment (" Middle Price for Buy: ",NormalizeDouble(midBuy,Digits),"\n",
            " Middle Price for Sell: ",NormalizeDouble(midSell,Digits));
   return (0);
}
//+------------------------------------------------------------------+
 
thanks masta aiman..script dkt post 87 tu dh bleh guna..skrg nk cari EA yg adjust TP jadi sama plak..
 
bro, swiss army EA boleh buat tu.. google je. tak pon multipurpose EA ada kat FF..
 
Bawah ni script.
Rasanya pakai be calculator kat sebelah lagi baik.
Code:
//+------------------------------------------------------------------+
//|                                                 Middle Price.mq4 |
//|                                          Copyright © 2010, Aiman |
//|                                                            Aiman |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Aiman"
#property link      "Aiman"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start ()
{
   double topBuy=0, botBuy, topSell=0, botSell, midBuy, midSell;
   for (int i=0; i<OrdersTotal(); i++)
   {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if (OrderSymbol()!=Symbol()) continue;
      if (OrderType()==OP_BUY)
      {
         if (topBuy==0) 
         {
            topBuy=OrderOpenPrice();
            botBuy=OrderOpenPrice();
         }
         else
         {
            topBuy=MathMax(topBuy,OrderOpenPrice());
            botBuy=MathMin(botBuy,OrderOpenPrice());
         }
      }
      if (OrderType()==OP_SELL)
      {
         if (topSell==0) 
         {
            topSell=OrderOpenPrice();
            botSell=OrderOpenPrice();
         }
         else
         {
            topSell=MathMax(topSell,OrderOpenPrice());
            botSell=MathMin(botSell,OrderOpenPrice());
         }
      }
   }
   if (topBuy!=0)  midBuy = (topBuy+botBuy)/2;
   if (topSell!=0) midSell= (topSell+botSell)/2;
   
   Comment (" Middle Price for Buy: ",NormalizeDouble(midBuy,Digits),"\n",
            " Middle Price for Sell: ",NormalizeDouble(midSell,Digits));
   return (0);
}
//+------------------------------------------------------------------+

nak try ngejas dulu..
harap2 jadi ler..
nak modify ea jer ni.. sekarang just buat manual jer, lambat sikit
nak buat ea sendiri tak berapa pandai lagi..

Thanks masta aiman...
 
sesapa yang belom ada

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);
}

ini script multipair, hati2 kalau nak close 1 pair je jangan guna script ni
 

Live Forex Chart

Currency
Rates
EUR / USD
1.14860
USD / JPY
156.877
GBP / USD
1.33765
USD / CHF
0.82250
USD / CAD
1.39985
EUR / JPY
180.138
AUD / USD
0.71167
Back
Top
Log in Register