Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
***
Pleaseinsert the codecorrectly: when editing a post, click on and insert your code in the pop-up window.
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
***
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 19.02.2008 |//| Описание : Возвращает суммарный профит в валюте депозита |//| закрытых с определённой даты позиций |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//| dt - Дата и время в секундах с 1970 года ( 0 - с начала истории) |//+----------------------------------------------------------------------------+double GetProfitFromDateInCurrency(string sy="",int op=-1,int mn=-1,datetime dt=0)
{
double p=0;
int i,k=OrdersHistoryTotal();
if(sy=="0") sy=Symbol();
for(i=0; i<k; i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if((OrderSymbol()==sy || sy=="") && (op<0 || OrderType()==op))
{
if(OrderType()==OP_BUY || OrderType()==OP_SELL)
{
if(mn<0 || OrderMagicNumber()==mn)
{
if(dt<OrderCloseTime())
{
p+=OrderProfit()+OrderCommission()+OrderSwap();
}
}
}
}
}
}
return(p);
}
Tatiana Zyrianova: Afternoon. Can you please tell whether an indicator can forcibly start the Calculate event by pressing a button on the chart that is handled in OnChartEvent?
ChartSetSymbolPeriod with the same symbol and timeframe can be used to update the chart (similar to the Refresh command in the terminal). Updating the chart in turn triggers recalculation of the indicators attached to it. Thus, you can recalculate the indicator on the chart even when there are no ticks (for example, on weekends).
Not exactly what I want. I want "if PROFIT FOR THE DAY has exceeded a certain percentage (already calculated) of the BALANCE at the beginning of the day, then stop trading, or vice versa, until it has not exceeded - then trade (function already exists, too). I really hope there are some ideas.
IT IS NECESSARY TO FIND THE ACCOUNT BALANCE AT THE BEGINNING OF THE DAY!!! Accountbalance changes all the time and therefore it cannot be used, you need a formula where it is set for a certain time probably. e.g. 00:01.
That's not quite what I need. I need "if PROFIT FOR THE DAY has exceeded a certain percentage (already calculated) of the BALANCE at the beginning of the day, then stop trading or vice versa, while NOT EXCEEDED - then trade (function also exists). I really hope there are some ideas.
IT IS NECESSARY TO FIND THE ACCOUNT BALANCE AT THE BEGINNING OF THE DAY!!! Accountbalance changes all the time and so it cannot be used, you need a formula where it is set for a certain time probably. e.g. 00:01.
Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
***
Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
***
I miscalculated here, in addition to the profit/loss for the day I need the account balance at the beginning of the day. :((( Help))
Account balance() - changes constantly, how to fix it for example on Hour==1 ?
Thank you for the answer. But I still can't figure out the right formula string that calculates this, I'm not familiar with many things. Could you spell it out here like.
***
Profit calculation...
if you want the current day's profits, then
I miscalculated here, in addition to the profit/loss for the day I need the account balance at the beginning of the day. :((( Help))
Account balance() - changes constantly, how to fix it for example on Hour==1 ?
Afternoon. Can you please tell whether an indicator can forcibly start the Calculate event by pressing a button on the chart that is handled in OnChartEvent?
ChartSetSymbolPeriod with the same symbol and timeframe can be used to update the chart (similar to the Refresh command in the terminal). Updating the chart in turn triggers recalculation of the indicators attached to it. Thus, you can recalculate the indicator on the chart even when there are no ticks (for example, on weekends).
Profit counting...
If you want the current day's profits, then
Not exactly what I want. I want "if PROFIT FOR THE DAY has exceeded a certain percentage (already calculated) of the BALANCE at the beginning of the day, then stop trading, or vice versa, until it has not exceeded - then trade (function already exists, too). I really hope there are some ideas.
IT IS NECESSARY TO FIND THE ACCOUNT BALANCE AT THE BEGINNING OF THE DAY!!! Accountbalance changes all the time and therefore it cannot be used, you need a formula where it is set for a certain time probably. e.g. 00:01.
Here it is, but it gives an error, help me fix it
error
That's not quite what I need. I need "if PROFIT FOR THE DAY has exceeded a certain percentage (already calculated) of the BALANCE at the beginning of the day, then stop trading or vice versa, while NOT EXCEEDED - then trade (function also exists). I really hope there are some ideas.
IT IS NECESSARY TO FIND THE ACCOUNT BALANCE AT THE BEGINNING OF THE DAY!!! Accountbalance changes all the time and so it cannot be used, you need a formula where it is set for a certain time probably. e.g. 00:01.
I told you
you need a formula that gives you the account balance as of the beginning of the day
I told you.
subtract the current day's profit from the current balance and you get the balance at the beginning of the day
look, the problem is that the percentage that I want to set, for example (1%) changes numerically and if
at each new trade the BALANCE will increase and so will the 1%. So my function will not work because there is no FIXED SET POINT.