Questions from Beginners MQL4 MT4 MetaTrader 4 - page 175
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
Can I have some of the code, I'm interested in how to loop through the dates?
//=================================================История на дату - Баланс ====================================================================================================
double Ballanc()
{
double date=0, history=0;
for ( int trade = OrdersTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == MagicLock && OrderSymbol() == Symbol())
{
date=Day();
}
}
for ( trade = date - 1; trade >= 0; trade--)
{
for ( int trade = OrdersHistoryTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade,SELECT_BY_POS,MODE_HISTORY))
{
=OrderProfit(;)
}
}
}
return(profithistory);
This is the function! The condition was to know the account balance as of the opening date of the locking order.
//=================================================История на дату - Баланс ====================================================================================================
double Ballanc()
{
int date=31,month=12,year=0;
double history=0,swaphistory=0;
for ( int trade = OrdersTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade, SELECT_BY_POS, MODE_TRADES) && OrderMagicNumber() == MagicLock && OrderSymbol() == Symbol())
{
year=Year();
}
}
for (int trade=year;trade>=2018;trade--)
{
for ( trade=month;trade>=1;trade--)
{
for ( trade = date; trade >= 1; trade--)
{
for ( trade = OrdersHistoryTotal() - 1; trade >= 0; trade-- )
{
if ( OrderSelect(trade,SELECT_BY_POS,MODE_HISTORY) && date==Day() && month==Month() && year==Year())
{
swaphistory+=OrderProfit();
swaphistory+=OrderSwap();
}
}
}
}
}
return(profithistory+swaphistory)
}
In the Metacvot library, which is used to make panels, the ON_DRAG_PROCESS event is implemented.
There is a need to handle the ON_DRAG_PROCESS event for a separate trend line rather than for the panel elements within the code of such a panel. Is it possible and how to implement it? I have tried it and failed.
Good afternoon!
Can you please tell me in which situations after EA deinitialization a memory leak like "1 leaked strings left" may occur?
No more objects remain, all dynamic ones are deleted, this is the only memory leak message
Hi, can you tell me how to modify the calculation of take profit and stop loss with every new bar?
You have a link to do it in your post: https://www.mql5.com/ru/articles/159.
Roughly, in OnTick to check if the bar has changed, and if it has changed - to call the necessary procedures to change the stop loss and take profit.
Guys, help me fix EA code, on the first signal it buys for all funds in lots of 0.1. The error is most likely in checking orders, it turns out not to check but to buy. I can not figure out how to fix