Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 101
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
Victor, take Kim's tried and tested function, which checks that the position is closed at TP:
isCloseLastPosByTake - Returns the flag to close the last position at the TP. Find it in Only useful functions
And then close everything.
It doesn't necessarily always work on a real position... Slippage and requotes when a take order is executed...
Kim's function compares position closing price with its take profit price. They may not coincide. The situation can be partially corrected by comparing the price difference with some delta, for example with the Slippage*Point value
Still, a good, responsive proger. As if all the problems were his, for that fate will reward, unquestionably, or, come across the grail.
Victor, take Kim's tried and tested function, which checks that the position is closed at TP:
isCloseLastPosByTake - Returns the flag to close the last position at the TP. Find it in Only useful functions
And then close everything.
Boris, it takes into account the last position closed on the take. I have a different problem:
1. Find the last open position out of the ones I already have (market and pending).
2. If last the open position closes on the take line, then close everything!
I.e. it's not the last position opened that closes on the take, it's another one that doesn't suit us...
Boris, he is taking into account the last closed position on the take. I have a different problem:
1. Find the last open position I already have (market and pending).
2. If last an open position will close at the takeaway then we close everything!
I.e. it's not the last position opened that closes on the take, but the one opened last, it doesn't suit us.
2. If it is closed at (or close to) the take --> Take note of its open time -->
3. Look through all open positions (MODE_TRADES) and compare their open time with the remembered (from step 2) --> If the remembered time of opening the position closed by TP (from step 2) is bigger than the other open positions --> It means that the last open position was closed by TP -->
4. Crop/delete all the rest to hell.
1. We are looking for the last closed position (MODE_HISTORY). 2. If it was closed by the Take position (or close to it) --> Remember its open time --> Look through all the open positions (MODE_TRADES) and compare their open time with the one memorized (from step 2) --> If the memorized open time of the position closed by the Take position (from step 2) is higher than the open time of the other open positions --> Then the last open position was closed by the Take position --> Tape/delete everything else.
In principle, also correct. Why isn't my logic correct? It seems to make sense too.
1. Going through all the open orders --> Finding the last open order.
2. Memorizing the time of the last open order.
3. I go through all the closed orders --> I compare the time of the last open order with the time of open order from the closed orders. If they are equal, then I save the time of closing of this order into a variable.
Everything seems to be clear.
In principle, also correct. And why isn't my logic correct? Seems to make sense too. 1. Go through all the open orders --> Found the last open order. 2. Memorizing the time of the last open order. 3. I look through all the closed orders --> I compare the time of the last open order with time of the open order from the closed orders. If they are equal, I save the time of closing of the given order into a variable.
It's kind of clear-cut...
It doesn't necessarily always work out on the real... Slippage and requotes when a take order is executed...
Kim's function compares the closing price of a position with its take profit price. They may not coincide. The situation can be partially corrected by comparing the price difference with some delta, for example with the Slippage*Point value
and it works exactly on Real.
Boris, he is taking into account the last position that closed on the take. I have a different problem:
1. Find the last open position of those already in place (market and pending).
2. If Last If the open position closes on the take side, then we close everything!
I.e. it's not the last open position that closes on the take, it's another one that we are not happy with...
Artyom, I have it checked by time, not by price! I've only added a time interval during which it checks,
and it works exactly on Real.
And on your fingers? How can time and price talk about closing on the take? I can certainly think it myself, but I'm already at 7.43am and haven't gone to bed yet.
And on your fingers? How can time and price tell you to close on the take? I can certainly think it myself, but it's 7.43 in the morning and I haven't gone to bed yet.