Questions from Beginners MQL4 MT4 MetaTrader 4 - page 180
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Yes, I am of the same opinion, but not only history and number of indicator buffers - i.e. again on memory allocation, if MT4 has gobbled up all the memory, then it is slowing down - apparently it starts freeing up memory areas
Definitely, the developers can answer, but we are talking about MetaTrader 4, and here ...
Why make any calculations in the code?
Don't do calculations - the topic was not smart, and I was interested to check what the optimizer does, so I drafted the code
You may add it to your code in such a way:
i.e. just write optimization parameters into the file, if it hangs, in the file you can read the last pass what parameters were and time of file will be time of "last breath" of the tester
The developers will be able to answer unambiguously, but we are talking about MetaTrader 4, and there ...
And here... nothing's going to change. We use what we have.
Hello, Can you advise me, the trading system only opens a position when a new hour bar opens under certain conditions. I need to make sure that if I close the position using a stop loss on the current bar, the trade will not open again. I implemented it this way :
if (OrdersTotal()==0 && ticket!=-1) // no open lots but ticket exists
{
if (OrderSelect(ticket,SELECT_BY_TICKET)==true)
{
datetime tct=OrderCloseTime(); // order close time
datetime tob=iTime(NULL,PERIOD_H1,0); // Open time of the current bar
if (tob>tct) // does not allow to open a new order if the trade has closed on the same bar as it opened
{
FUNCTION TO OPEN A POSITION
}
In the strategy tester, reopened positions are no longer opened, but when trading live, a position is opened. Can you tell me what's wrong?)
Hello, Can you tell me if the trading system opens a position only at the opening of a new hourly bar under certain conditions? I need to make sure that if I close the position using a stop loss on the current bar, the trade will not open again. I implemented it this way :
if (OrdersTotal()==0 && ticket!=-1) // no open lots but ticket exists
{
if (OrderSelect(ticket,SELECT_BY_TICKET)==true)
{
datetime tct=OrderCloseTime(); // order close time
datetime tob=iTime(NULL,PERIOD_H1,0); // Open time of the current bar
if (tob>tct) // does not allow to open a new order if the trade has closed on the same bar as it opened
{
FUNCTION TO OPEN A POSITION
}
In the strategy tester, reopened positions are no longer opened, but when trading live, a position is opened. Can you tell me what's wrong?)
Is it?
Is it?
not really. What's wrong with my variant ? the main condition is not being able to re-enter on the current hourly candle ! It's a pretty simple condition, what's wrong with it and why doesn't it work ?
not really. What's wrong with my variant? the main condition is that it is not possible to re-enter on the current candle! It's a pretty simple condition, what's wrong with it and why doesn't it work?
And what ticket did you choose in OrderSelect?
Which ticket did you select in OrderSelect?
The ticket is passed to the last order. When an order is open, the opening of new orders is impossible within the system, and the pending orders cannot take place either. So, the last ticket is the last order at stop or profit.
How do you pass the ticket of the last order?
And OrdersTotal() passes the total number of open and pending orders.
Here is the new bar of the current timeframe.
How do you pass the ticket of the last order?
And OrdersTotal() passes the total number of open and pending orders.
Here is the new bar of the current timeframe.
The ticket is declared as a global variable. A ticket is passed to buy or sell. In my system, several orders cannot be opened, only one order can be opened, and there cannot be any pending ones either. Therefore, the last ticket, as I understand it, is an order closed at profit or stop.
ok, my head is buzzing... i will rethink your advice tomorrow