Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 749
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
Poor little guy.
If you can explain it in a line of code and with comments, as in my previous code, I'll be extremely grateful.
"I have doubts", and I can't help feeling that it's all about the caching mechanism of the market environment.
So that the terminal doesn't have to "run to the server" for every occasion, such as OrdersTotal(), OrderSymbol() etc., the market environment is copied into some cache, and it seems to be different for each script, but the script deals only with this cache. The cache is NOT automatically updated during the entire runtime of the main script function even after successful execution of functions like OrderSend() changing the market environment on the server, therefore, the order appearing in the script "is not visible", i.e. it makes an illusion of its absence. It simply cannot be detected in the for loop, which is why OrderModify() is not called. This is a hypothesis that arose on the basis of vague doubts and incomprehensible feelings.
The described cache can be forcibly updated using RefreshRates() call, for example, immediately after OrderSend() is called. Check if the hypothesis is correct.
If, among other things, RefreshRates() returns true, then this is an additional indirect confirmation of the hypothesis.
If you explain it to me in a line of code and with comments, as in my previous code, I will be extremely grateful.
"I have doubts", and I can't help feeling that it's all about the caching mechanism of the market environment.
So that the terminal doesn't have to "run to the server" for every occasion, such as OrdersTotal(), OrderSymbol() etc., the market environment is copied into some cache, and it seems to be different for each script, but the script deals only with this cache. The cache is NOT automatically updated during the entire runtime of the main script function even after successful execution of functions like OrderSend() changing the market environment on the server, therefore, the order appearing inside the script "is not visible", i.e. it makes an illusion of its absence. It simply cannot be detected in the for loop, which is why OrderModify() is not called. This is the hypothesis that arose based on vague doubts and unconvincing feelings.
The described cache can be forcedly updated using RefreshRates() call, for example, immediately after OrderSend() call. Check if the hypothesis is correct.
If, among other things, RefreshRates() returns true, this is an additional indirect confirmation of the hypothesis.
Hello. Please advise, if i know, i am trying to calculate a StopLoss from low and high of 1st bar, after a pending order is placed, for buy and sell respectively. But i got nothing, only 130 error and nothing else. Thank you in advance.
Check if OrderOpenPrice() is too close to SL, and if stops are "on the right side of price". You can read about it here:
StopLoss and TakeProfit prices cannot be too close to the market. The minimum stop distance in pips can be obtained using the MarketInfo() function with the MODE_STOPLEVEL parameter. Error 130 (ERR_INVALID_STOPS) will be generated in case of wrong or non-normalized stops.
In this case, that is, for a pending order, the "market" is its "pending open price".
You are normalising the wrong thing.
Hello. Any advice? I'm trying to calculate StopLoss from the low and high of the 1st bar, after placing pending order, for buy and sell respectively. But i got no result, only 130 error, that's all. Thank you in advance.