sunnyfx
Super Active Member
- Messages
- 7,802
- Joined
- Jan 6, 2008
- Messages
- 7,802
- Reaction score
- 73
- Points
- 70
ke default macam ni jek, ye kot.![]()
Ko test kat demo dulu bro.....aku lama tak layan coding ni...banyak lupa skang...
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ke default macam ni jek, ye kot.![]()
//+------------------------------------------------------------------+
//| CloseTrades_After_Account_Profit_Re ached.mq4 |
//| Copyright © 2007, Tradinator |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Tradinator"
#property link "[email protected]"
extern double My_Money_Profit_Target=300; //The amount of money profit at which you want to close ALL open trades.
int Slippage=5;
int i;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
if (AccountProfit()>= My_Money_Profit_Target)
{
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS);
int type = OrderType();
bool result = false;
switch(type)
{
//Close opened long positions
case OP_BUY : result = OrderClose(OrderTicket(),OrderLots( ),MarketInfo(OrderSymbol(),MODE_BID ),Slippage,Pink);
break;
//Close opened short positions
case OP_SELL : result = OrderClose(OrderTicket(),OrderLots( ),MarketInfo(OrderSymbol(),MODE_ASK ),Slippage,Pink);
break;
//Close pending orders
case OP_BUYLIMIT :
case OP_BUYSTOP :
case OP_SELLLIMIT :
case OP_SELLSTOP : result = OrderDelete( OrderTicket() );
}
if(result == false)
{
Sleep(3000);
}
}
Print ("Account Profit Reached. All Open & Pending Trades Have Been Closed");
return(0);
}
Comment("Balance: ",AccountBalance(),", Account Equity: ",AccountEquity(),", Account Profit: ",AccountProfit(),
"\nMy Account Profit Target: ",My_Money_Profit_Target);
return(0);

