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

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
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 :(
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?
Help fix the function
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...
Instead...
... Next ...
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?
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.
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.
What is the maximum number of bars in the story? Maybe the story is already trimmed.