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

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
Gentlemen, can you tell me where I made a mistake when I inserted this timing function into my EA code?
The compiler just flooded me with errors.
In the place where you declared a function inside another function:
See the 10th parameter of the specified function. Set to 0.
OrderSend(g_symbol_284, OP_BUY, Lots, g_ask_528 - gi_164 * g_point_400, Slippage, l_price_40, l_price_32, 0, g_magic_112, "Newest", MediumBlue);
found this line and what to change there ?
The use is simple - I run the script...
You can find examples of similar functions here: Useful functions from KimIV.
If off-the-shelf ones don't fit, you can build your own one by analogy with existing ones.
Here the calculation is based on price inertia. I.e. stop loss of the first order is triggered, the second order is at a profit with a value a little less than the loss. If the price moves in the same direction some more, then yes, we may be in the total profit.
But, imho, this strategy is not worth a bite.
This is exactly what we have to prove. In other words, you need a code that would find the necessary order. There are dozens of such situations, and we can't provide a special function for each of them to simplify the code. It must be written for each case.
You can find examples of similar functions here: Useful functions from KimIV.
If off-the-shelf ones don't fit, you can build your own one by analogy with existing ones.
I think I didn't quite get the point across.
Assertion 1. Every code, after the pending order triggering, when accessing the date of opening of this order (that has become marketable at the moment of such triggering), will obtain the open date equal to the date of pending order placing - this 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 we need to collect and record it), 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.
OrderSend(g_symbol_284, OP_BUY, Lots, g_ask_528 - gi_164 * g_point_400, Slippage, l_price_40, l_price_32, 0, g_magic_112, "Newest", MediumBlue);
found this line and what to change there ?
OrderSend(g_symbol_284, OP_BUY, Lots, g_ask_528 - gi_164 * g_point_400, Slippage, l_price_40, l_price_32, 0, g_magic_112, "Newest", MediumBlue);
found this line and what to change there ?
here's the whole line
here's the whole line
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
PapaYozh:
Where you declared a function within another function:
In the end the compiler showed me these errors, and I think it is referring to the wrong variable definition?Thank you for your feedback, dear PapaYozh,but I have inserted this function into int start(), but the result of the compiler does not change anyway.
I apologize for any inconvenience, incomprehension, after all, just beginning to gain experience in such a not easy matter, and I think thanks to this forum and the people who responded here, continue to develop and improve their skills, thank you.