
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Please use Equity Guard. It will serve your purpose here.
Please use Equity Guard. It will serve your purpose here.
//+------------------------------------------------------------------------+
//| Closes everything
//+------------------------------------------------------------------------+
void CloseAll()
{
string symbol = Symbol();
for(int i=OrdersTotal()-1;i>=0;i--)
//for(int ii=0;ii<OrdersTotal();ii++)
{
bool result=false;
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if((OrderMagicNumber()!=Magicsell || OrderMagicNumber()!=Magicbuy) && OrderSymbol() != symbol) continue;
//double result;
if ( OrderType() == OP_BUY) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
if ( OrderType() == OP_SELL) result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
//if ( OrderType()== OP_BUYSTOP) result = OrderDelete( OrderTicket() );
//if ( OrderType()== OP_SELLSTOP) result = OrderDelete( OrderTicket() );
if(result)i++;
}
return;
}
//+------------------------------------------------------------------+
//| profit/loss open buy |
//+------------------------------------------------------------------+
int profitopenbuy()
{
double totalopenbuy=0;
int i;
for(i=0; i<OrdersTotal(); i++)
{
//double resultsell2=0;
//double resultsell3=0;
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderMagicNumber()!=Magicbuy && OrderSymbol() != Symbol()) continue;
//if(OrderProfit()<0) resultsell2 = OrderProfit();
//if(OrderProfit()>0) resultsell3 = OrderProfit();
if (OrderType() == OP_BUY && OrderMagicNumber()==Magicbuy) totalopenbuy = totalopenbuy+OrderProfit();
//if ( OrderType() == OP_SELL && OrderMagicNumber()==Magicsell) totalopenbuy = totalopenbuy+OrderProfit();
//totalsell++; // count if matched
}
return(totalopenbuy);
}
//+------------------------------------------------------------------+
//| profit/loss open sell |
//+------------------------------------------------------------------+
int profitopensell()
{
double totalopensell=0;
//double ticketsell=0;
int i;
for(i=0; i<OrdersTotal(); i++)
{
//double resultsell2=0;
//double resultsell3=0;
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
if(OrderMagicNumber()!=Magicsell && OrderSymbol() != Symbol()) continue;
//if(OrderProfit()<0) resultsell2 = OrderProfit();
//if(OrderProfit()>0) resultsell3 = OrderProfit();
//if ( OrderType() == OP_BUY && OrderMagicNumber()==Magicbuy) totalbuy = (totalbuy+OrderProfit());
if (OrderType() == OP_SELL && OrderMagicNumber()==Magicsell) totalopensell = totalopensell+OrderProfit();
}
return(totalopensell);
}
These functions may help. When your equity is where you want it. You can call a function.
Gordon Gekko:
James:
BUDLogic v1.0:
General rules and best pratices of the Forum. - General - MQL5 programming forum
Among Trailing Equity EA's, as per my experience, Equity Sentry is the best one.
It will close all running EA's and will shutdown your MT4 terminal (best in case you are copying signals from other traders)
EA can perform several actions on Trigger:
Among Trailing Equity EA's, as per my experience, Equity Sentry is the best one.
It will close all running EA's and will shutdown your MT4 terminal (best in case you are copying signals from other traders)
EA can perform several actions on Trigger:
Among Trailing Equity EA's, as per my experience, Equity Sentry is the best one.
It will close all running EA's and will shutdown your MT4 terminal (best in case you are copying signals from other traders)
EA can perform several actions on Trigger:
This uses the profit loss column. NOT the equity. You can have a loss in the profit column but still have a profit over all between your equity and balance. This does not work for closing $ on equity. Look at your MT4 and see the names for the columns.
hello,
i am trying to design an ea. its almost 80 % done. i need someone to complete it for me. i have the files ready.
i need some few adjustments.
COME LETS DO IT TOGETHER....
BELOW IS ITS PERFORMANCE ON TEST.
EMAIL: norgbewisdom@gmai.com