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

 
Valdemar:


Thank you for your feedback dear PapaYozh,but I also inserted this function into int start(), it still does not change the result of the compiler.

In the end the compiler shows me these errors, and I think it's referring to the wrong variable definition?

Voldemar, people are trying to tell you what all the docs, tutorials and examples say: the body of a user function must be outside other functions, for example, after the last line of the Start function.
 
ilunga:

Again:

Documentation:

int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment=NULL, int magic=0, datetime expiration=0, color arrow_color=CLR_NONE)

Your tenth parameter in the "Newest" string is not a number. That's why there is an error

So you just have to remove it?
 
Pyxlik2009:
So it just needs to be removed?

You need to pass the parameters correctly to the called function.
 

Guys help please

 
granit77:
Voldemar, people are trying to tell you what all the docs, tutorials and examples say: the body of a custom function must be placed BEFORE the other functions, e.g. after the last line of the Start function.


Thank yougranit77 and everyone who gave me their precious time. I succeeded, because I think everyone rejoiced at the appearance of the first successes in achieving the conceived goal.

Thanks!!!!

...I hope to be able to help someone here in the near future.



 
Pyxlik2009:

Guys, please help.

Do you want me to hold it for you? :))))

Replace "Newest" with a number.

 
Starting:


I don't think I quite got the point across.

Assertion 1. Every code, after the pending order triggering, when accessing the date of opening of that order (that has become marketable at the moment of triggering) will obtain the open date equal to the date of setting the pending order - that is how the OrderOpenTime() function works.

Assertion 2: You can't remember the exact time of pending order triggering, without an Expert Advisor that constantly monitors the state of orders on the account.


Possible Solution 1. We can try to run from the date of setting the pending order to the current date and note the time of the first crossing of the open price and the trigger level.

This will be more or less exact time, but there is a big minus: the spread. Since we do not record the spread in the history (I am not taking the tick history with spread taken from Dukas, for example, since I am not trading in Dukas and this kind of history with spread should be collected and recorded), the order may have triggered much earlier, when the price almost touched the open level but did not cross it, and the order was opened due to the spread expansion, not later, when we actually saw the price crossing the pending order setting line.


The most probable solution is to create an Expert Advisor, put it on the chart and monitor the orders in the account. I do not want to do it for some reasons and there are also disadvantages associated with possible problems during breaks in the EA operation.


The functions, which you have referred to. You have provided a link to the OrderOpenTime() function. For the delayed orders it will be the date of their creation, and not of their triggering. Therefore, the existing functions are not suitable. And there is no way to combine them, since they still refer to OrderOpenTime() for the order open date.


Something alarms me in your assertions. After the conversion of a pending order with the ticket, for example, 12, there will be no pending order with ticket 12 in the history. There will be an open position with ticket 12, and its type will be OP_BUY or OP_SELL. The time of its opening is the time of pending order transformation into a market order.

Please correct me if it is wrong.

In any case, you need an Expert Advisor that will do the order accounting for you. On every tick you check if there is a pending order, memorize its ticket (if the order is found) and then compare the ticks of open positions with the pending one. As soon as you find a match - remember the time of its opening. This will be the time you are looking for...

 

Question - is it possible to use scripts and third party EAs (from the "don't trade themselves" series) on an owl that you run through a tester?

 
artmedia70:

Do you want me to hold it for you? :))))

Replace "Newest" with a number.

Already figured it out. Thanks.)
 
artmedia70:

There is something about your statements that makes me uneasy. After the conversion of a pending order with ticket 12, for example, there will be no pending order with ticket 12 in history. There will be an open position with ticket 12, and its type will be OP_BUY or OP_SELL. The time of its opening is the time of pending order transformation into a market order.

Please correct me if it is wrong.

In any case, you need an Expert Advisor that will do the order accounting for you. On every tick you check if there is a pending order, memorize its ticket (if the order is found) and then compare the ticks of open positions with the pending one. As soon as you find a match - remember the time of its opening. This will be your desired one.

Yes, the ticket of market order after pending order triggering has not changed (at least with my broker).

Thetime of opening of a market position will be the time of pending order modification. At least according to the logs, I compared it now using one of the orders as an example.

Assertion 1, on this basis, is obviously wrong. I will double-check it tomorrow while fresh; I was working on it for a couple of nights (not exactly), my brain is already foggy.

If the OrderOpenTime() of a market order with a pending order still shows the time of its opening, we have no problems at all and the EA is not needed to track orders. All we need is just the time of pending order triggering in order to correctly sort orders from the history by their open time and the flag that they are closed. It doesn't even matter if it was just a market order that was pending and there were no flags showing that it was a pending order - this is not necessary. The important thing is the fact - it was closed last and with the latest open date - our client, bring it here.

It's just that there is no way my script could give out the last closed order with the latest open time, exactly when the pending orders were triggered. Anyway, I will check everything. Thank you for the tip, very helpful!

Reason: