|
trading stats
use this code:
// ************************************************** *************************
int stats()
{
int i, vOrders;
// current CP profit
vOrders = OrdersTotal();
Profit = 0;
PipsProfit = 0;
for(i=vOrders-1;i>=0;i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if(OrderSymbol() == Symbol())
{
Profit += OrderProfit();
if (OrderType() == OP_BUY) PipsProfit += ((Bid - OrderOpenPrice())/Point);
else if (OrderType() == OP_SELL) PipsProfit += ((OrderOpenPrice() - Ask)/Point);
}
}
}
// potential risk
// max positions
}
Profit & PipsProfit will need to be declared outside the program, then display then on the screen with your favorite method. Comments if nothing else.
Mark
|