BTC USD 84,614.4 Gold USD 4,177.45
Time now: Jun 1, 12:00 AM

buy all pair....

cuba try ni, aku kopi paste je ni dr script aku dpt kat thread 1000pips/3000pips tu. kredit kpd masta lukpayat & masta coding aiman.

//+------------------------------------------------------------------+
//| Open BUY USD PAIR.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
// allow script to accept inputs from user
#property show_inputs

//user input
extern double Lots = 0.2;
extern int Slippage = 2;
extern int TP = 10;
extern int SL = 0;
extern string MiniSetting = "Mini/Micro Setting:";
extern bool isMini = false;
extern string postfix = ".";

// globals
string mySymbol;

// trade management
double ask, bid, point;

string TradeComment = "Buy ALL pair!";
int MagicNumber = 12345678;


// used for verbose error logging
#include <stdlib.mqh>


//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int init() {
if(!isMini) postfix="";

mySymbol = "GBPUSD" + postfix; OpenPos("Buy");
mySymbol = "AUDUSD" + postfix; OpenPos("Buy");
mySymbol = "EURUSD" + postfix; OpenPos("Buy");
mySymbol = "NZDUSD" + postfix; OpenPos("Buy");
// mySymbol = "USDJPY" + postfix; OpenPos("Sell");
mySymbol = "USDCAD" + postfix; OpenPos("Sell");
mySymbol = "USDCHF" + postfix; OpenPos("Sell");

mySymbol = "GBPJPY" + postfix; OpenPos("Buy");
mySymbol = "AUDJPY" + postfix; OpenPos("Buy");
mySymbol = "EURJPY" + postfix; OpenPos("Buy");
mySymbol = "NZDJPY" + postfix; OpenPos("Buy");
mySymbol = "CHFJPY" + postfix; OpenPos("Buy");
// testing
mySymbol = "CADJPY" + postfix; OpenPos("Buy");
}

int start() {}

void OpenPos(string Trade) {
int gle = 0;
int ticket = 0;

int loopcount;

loopcount=0;

while(true) {
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; }

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+" SL="+SL+" TP="+TP+" Bid="+bid+" Ask="+ask+" ticket="+ticket+" Err="+gle+" "+ErrorDescription(gle));
if (Trade == "Sell") Print("-----ERROR----- placing SELL order: Lots="+Lots+" SL="+SL+" TP="+TP+" Bid="+bid+" Ask="+ask+" ticket="+ticket+" Err="+gle+" "+ErrorDescription(gle));

RefreshRates();
Sleep(500);

// give up after 10 tries (~5 seconds)
loopcount++;

if(loopcount > 10) {
if (Trade == "Buy") Print("-----ERROR----- Giving up on placing BUY order");
if (Trade == "Sell") Print("-----ERROR----- Giving up on placing SELL order");

return(gle);
}
}
}
}
 
kalau buy all USD/XX pair tadi memang mantop....
 

Latest Posts

Live Forex Chart

Currency
Rates
EUR / USD
1.12429
USD / JPY
158.129
GBP / USD
1.31940
USD / CHF
0.83072
USD / CAD
1.42257
EUR / JPY
177.717
AUD / USD
0.69302
Back
Top
Log in Register