# forex software

Create and Test Forex Strategies

forex software

Forex Software

Create and Test Forex Strategies

# Daily Profit Calculation

Forex Software → Daily Profit Calculation

Pages 1

## Posts: 4

#### Topic: Daily Profit Calculation

Hi,
@Popov is the current Daily Profit calculation depends on the MT4 account? When i use 2-3-4 Portfolio EAs at once he calculates the daily profit of alle EAs or only for the one EA?

Cause when i look in code i think there is missing something in code that for only the magicnumber it have to calculate or i am wrong?

``````double CalculateDailyProfit()
{
const datetime t0 = TimeCurrent();
const datetime t1 = t0 - 60*60*24;

double dailyProfit = 0.0;

const int totalOrders = OrdersTotal();
for(int i=0; i < totalOrders; i+=1) {
if(OrderSelect(i, SELECT_BY_POS)) {
if((OrderCloseTime() > t1 && OrderCloseTime() <= t0) ||
OrderCloseTime() == 0) {
if(OrderType() <= OP_SELL) {
dailyProfit += OrderProfit();
dailyProfit -= OrderSwap();
dailyProfit -= OrderCommission();
}
}
}
}

return dailyProfit;
}``````

didnt it have to be such code than

``````double CalculateDailyProfit()
{
[b]    int minMagic = GetMagicNumber(0);
int maxMagic = GetMagicNumber(strategiesCount);[/b]

const datetime t0 = TimeCurrent();
const datetime t1 = t0 - 60*60*24;

double dailyProfit = 0.0;

const int totalOrders = OrdersTotal();
for(int i=0; i < totalOrders; i+=1) {
if(OrderSelect(i, SELECT_BY_POS)) {

[b]         int magicNumber = OrderMagicNumber();
if (magicNumber >= minMagic && magicNumber <= maxMagic)[/b]

if((OrderCloseTime() > t1 && OrderCloseTime() <= t0) ||
OrderCloseTime() == 0) {
if(OrderType() <= OP_SELL) {
dailyProfit += OrderProfit();
dailyProfit -= OrderSwap();
dailyProfit -= OrderCommission();
}
}
}
}

return dailyProfit;
}``````

So this code only read daily profit of the magicnumber of the ea and only this close.

#### Re: Daily Profit Calculation

> When i use 2-3-4 Portfolio EAs at once he calculates the daily profit of alle EAs or only for the one EA?

I'll work on the Portfolio MQL very soon. I'll provide better statistics and also possibility to enable / Disable particular strategies.

For the stats, we will have total portfolio stats and stats for each particular strategy in the MT chart.

#### Re: Daily Profit Calculation

Popov wrote:

> When i use 2-3-4 Portfolio EAs at once he calculates the daily profit of alle EAs or only for the one EA?

I'll work on the Portfolio MQL very soon. I'll provide better statistics and also possibility to enable / Disable particular strategies.

For the stats, we will have total portfolio stats and stats for each particular strategy in the MT chart.

When will it be ready ?

#### Re: Daily Profit Calculation

Great it is very necessary

Popov wrote:

> When i use 2-3-4 Portfolio EAs at once he calculates the daily profit of alle EAs or only for the one EA?

I'll work on the Portfolio MQL very soon. I'll provide better statistics and also possibility to enable / Disable particular strategies.

For the stats, we will have total portfolio stats and stats for each particular strategy in the MT chart.

Pages 1