Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 125
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
I don't get it:
if open on the first bar, are we looking from zero to zero?
This is a small hedge in case the opening price of the order is already much higher than Low at the time of opening. I.e. we do not use the opening bar for searching. That is what PERIOD_M1 is for.
I'd do it differently. In general, I would only start searching when the position has lasted for more than one bar. After all, the best price may be just on the opening bar, and we'll waste it...
I agree. It would probably be more efficient to remember the minimum (or maximum) price for each open order in the array on each tick, and close the orders when the condition is reached, than to re-search the minimum from the moment the order was opened, so to speak:
And in case of troubles like loss of connection, restarting of advisor, etc. we should modify stoploss at orders from time to time.I argued that the array must be passed here by reference. Otherwise, the function will have to work with only one strictly defined array. Even if you have it defined globally.
Hmm. It depends on which array is passed to the calling function. If it's a specific array, then the called function will work with it... Because that's...
If, for example,
By calling it in this way:
It works with the OrdersMassive array.
And so:
With the massiveOfOrders array.
Can you tell me how to find out the size of spread, at the moment of opening a trade, or, better, how to display it in the log?
If (spread) == some value, then... do something... (For example, open an order or print its value in the journal). Or vice versa, if it is not equal to or greater than (less than) some value, then we display it in the journal and do something. You can do whatever you like.
I will repeat the question I asked yesterday. I don't want to post it in a separate thread. If anything is not clear, I will answer all questions.
I'm still having a hard time closing the required positions. The situation is as follows:
1. The closing of positions is being tracked.
2. As soon as the last position has closed at the take line... ...all open and pending positions should be closed at once. Everything is closed sorted by lots, i.e. large lots at once, and then smaller. This is intended only for gaining experience with orders.
The implementation is as follows:
In start() on every tick:
We are interested in closing market orders since the pending one is deleted as required. Here is what we have:
For some reason some of the orders are not being closed. I print some segments when I see them, I don't understand anything. Here is an example:
The comment shows that lastOOTHist = 01:30:00, though this is not actually correct. If we check lastOOTHist in the results window, we will see that
their closing times are different...
What is wrong here?
Hmm. It depends on which array is passed to the calling function. If it's a specific array, then the called function will work with it... Because that's...
If, for example,
By calling it in this way:
It works with the OrdersMassive array.
And so:
With array massiveOfOrders.
When you pass a variable (array) to a function by value, a local variable is created inside the function and you declare it in the header: myFunct(int my_var). This way, changes of this variable cannot be seen outside the function. And in the case of an array, the compiler will remind you of this.
If you want the changes in the variable's value to be visible outside (outside the function), pass the variables by reference : myFunct(int & my_var)
It depends upon which array is passed to the calling function. If there's a certain array, then the called function will work with it... It's like this...
If, for example,
By calling it like this:
It works with the OrdersMassive array
And this way:
With array massiveOfOrders
I will repeat the question I asked yesterday. I don't want to post it in a separate thread. If anything is not clear, I will answer all questions.
I'm still having a hard time closing the required positions. The situation is as follows:
1. The closing of positions is being tracked.
2. As soon as the last position has closed at the take line... ...all open and pending positions should be closed at once. Everything is closed sorted by lots, i.e. large lots at once, and then smaller. This is intended only for gaining experience with orders.
The implementation is as follows:
In start() on every tick:
We are interested in closing market orders since the pending one is deleted as required. Here is what we have:
For some reason some of the orders are not being closed. I print some segments when I see them, I don't understand anything. Here is an example:
The comment shows that lastOOTHist = 01:30:00, though this is not actually correct. If we check lastOOTHist in the results window, we will see that
their closing times are different...
What is wrong here?
You got it all mixed up...
right here:
Unprint the values of all the cells in the array before the loop - maybe that's where the dog is digging in.