[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 227

 
Neo333:
Hi, here's the problem: The EA sets pending limit orders, then the price moves and the orders become market orders. Everything works, but on some orders there is an absolutely unclear glitch, since all the orders are set through a certain fixed constant "K", the distance between them should always be a constant (Rn+1 = Rn + "K"). However, we have no luck; the order is open, the price is indicated and everything is checked but the distance from the previous order to the next one is not equal to "K". If we check the results of arithmetic operations with the prices, i.e. if we just subtract and check the result, it is equal to "K"; however logical comparison == still shows false and this leads the EA to constantly open orders at that price and thus "think" that there is no order there. Sorry if it's too long, I just wanted to explain in more detail. Honestly, I really don't understand what to do :(
If you compare by ==, then use NormalizeDouble, in general the better MathAbs(Price1-Price2)<delta
 
VladimirR:

Thanks a lot! But there is this 2011.09.30 21:26:49 TestGenerator: unmatched data error (volume limit 13634 at 2011.07.19 20:00 exceeded)

As far as I understood, this message does not concern the Expert Advisor, but I still would like to know how to understand it?



Inconsistency in the timeframe story. https://www.mql5.com/ru/forum/108760
 
sergeev:

Help fix the function


73
Eugene1 30.09.2011 16:19

I'm trying to write a function that determines the closing price of the last order (by the time closest to the current time)

I write it like this:


But

do

uble PriceCloseLastPos(string smb = "", int cmd = -1, int mMin = -1, int mMax = -1) {
int ticketDateTime=0;
int orderTicket=-1;
double closePrice = 0;
int ordTotal = OrdersTotal();
if (smb == "0") smb = Symbol();
for (int i = 0; i < ordTotal; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol() == smb || smb == "") {
if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
if (cmd < OP_BUY || OrderType() == cmd) {
if (mMin < 0 || (OrderMagicNumber() >= mMin && OrderMagicNumber() <= mMax)) {
if (ticketDateTime < OrderCloseTime()) {
ticketDateTime = OrderCloseTime();
orderTicket = OrderTicket();
closePrice = OrderClosePrice();
}
}
}
}
}
}
}
if(orderTicket > -1) OrderSelect(orderTicket, SELECT_BY_TICKET, MODE_HISTORY );
return(closePrice);
}

But for some reason, the function returns the data of the very first order which was opened in the tester.

Actually this is my intermediate goal. I wanted to write a function that would give the last closing price of a partial order (not for the whole lot volume). But I don't know how to bother...

int ordTotal = OrdersTotal();

Instead...

int ordTotal = OrdersHistoryTotal();

... Next ...

if(orderTicket > -1) OrderSelect(orderTicket, SELECT_BY_TICKET, MODE_HISTORY );

Here, I see that your knowledge is not very good. When selecting an order by ticket, the pool parameter is ignored. I.e., it is useless to write MODE_HISTORY - this parameter only refers to selection by index.

If an order has been selected by ticket, you need to check the closing time to ensure that it has been selected from the list of closed orders. It must be greater than zero - only closed positions have this parameter >0.

 
On the 5 minute timeframe in the MT4 trading terminal, the history is not displayed. Can this be solved?
 
rosman:
On the 5 minute timeframe in the MT4 trading terminal, the history is not displayed. Can this be solved?
I apologize for the stupid question. I meant the history before November 2010 is not displayed :)
 
rosman:
I apologize for the blunt question. I meant the history before November 2010 is not displayed :)

So it's not there. You can also clarify. Try to make more bars on the chart in MT4 settings.

It is solved by downloading or buying a longer history.

 
Zhunko:

Then she doesn't exist. You can also clarify. Try to make more bars on the chart in MT4 settings.

This can be solved by downloading or buying longer history.

Service>Settings>Charts tab >maximum number of bars in the window was 65 000 --> changed it to 100 000 or more, still only November 2010 is the latest. The quotes archive for this instrument and timeframe is fully loaded - all the way down to November 1999
 
What is the maximum number of bars in the story? Maybe the story is already trimmed.
 
Zhunko:
What is the maximum number of bars in the story? Maybe the story is already trimmed.
Is worth 10,000,000.
 
Upload the archive. I'll have a look at mine.
Reason: