- Beranda
- Komunitas
- Pemrograman
- Question about SELECT_BY_POS
Edit Komentar Anda
Question about SELECT_BY_POS
forex_trader_211931
Menjadi Anggota Sejak Oct 14, 2014
11 postingan
Mar 19, 2015 at 13:38
Menjadi Anggota Sejak Oct 14, 2014
11 postingan
Hey guys,
This may be a very silly question, but suppose I have 4 trades open, they will have Position 0, 1, 2 and 3 on the MODE_TRADES pool..
Now, if I close the order that's assigned to position 2, will I be left with positions 0, 1 and 3, or will the order in position 3 be reassigned to position 2?
This may be a very silly question, but suppose I have 4 trades open, they will have Position 0, 1, 2 and 3 on the MODE_TRADES pool..
Now, if I close the order that's assigned to position 2, will I be left with positions 0, 1 and 3, or will the order in position 3 be reassigned to position 2?
Menjadi Anggota Sejak Nov 21, 2011
1601 postingan
Mar 19, 2015 at 18:05
Menjadi Anggota Sejak Nov 21, 2011
1601 postingan
Renko posted:
Hey guys,
This may be a very silly question, but suppose I have 4 trades open, they will have Position 0, 1, 2 and 3 on the MODE_TRADES pool..
Now, if I close the order that's assigned to position 2, will the order in position 3 be reassigned to position 2?
Yes I guess so.
Simply do a test by closing 2, then check if it closes 2 positions.
forex_trader_25447
Menjadi Anggota Sejak Dec 21, 2010
127 postingan
Mar 20, 2015 at 09:52
(diedit Mar 20, 2015 at 10:17 yang lalu)
Menjadi Anggota Sejak Dec 21, 2010
127 postingan
Any pool, at any time, have indexes form 0 to MAX-1 !
... where MAX can be : OrdersHistoryTotal() or OrdersTotal() .
Any trade operation change both pools (list of orders) immediately.
WARNING : Before new OrderSelect() , you still have old data selected (loaded in memory) !!!
So, If you have 4 active position ( list index =0,1,2,3 ),
and close position ( index=2 ),
the result is :
-> Total position = 3
-> possible List index = 0,1,2
So here is a test :
- if you have 4 positions, and close position=2, try :
--> OrderSelect(3,SELECT_BY_POS,=MODE_TRADES ); ==> return ERROR
--> OrderSelect(2,SELECT_BY_POS,=MODE_TRADES ); ==> return current position=2, previous=3
... where MAX can be : OrdersHistoryTotal() or OrdersTotal() .
Any trade operation change both pools (list of orders) immediately.
WARNING : Before new OrderSelect() , you still have old data selected (loaded in memory) !!!
So, If you have 4 active position ( list index =0,1,2,3 ),
and close position ( index=2 ),
the result is :
-> Total position = 3
-> possible List index = 0,1,2
So here is a test :
- if you have 4 positions, and close position=2, try :
--> OrderSelect(3,SELECT_BY_POS,=MODE_TRADES ); ==> return ERROR
--> OrderSelect(2,SELECT_BY_POS,=MODE_TRADES ); ==> return current position=2, previous=3
Menjadi Anggota Sejak Feb 11, 2015
14 postingan
Mar 20, 2015 at 10:22
Menjadi Anggota Sejak Feb 11, 2015
14 postingan
its a kind of silly ques but try something on 2
forex_trader_211931
Menjadi Anggota Sejak Oct 14, 2014
11 postingan
Menjadi Anggota Sejak Sep 20, 2014
342 postingan
Mar 29, 2015 at 04:32
(diedit Mar 29, 2015 at 05:01 yang lalu)
Menjadi Anggota Sejak Sep 20, 2014
342 postingan
I quite frankly don't know why you would do something like that.
If you use a loop, as in:
for (i= 0 ;i< OrdersTotal(),i++){
OrderSelect(i,SELECT_BY_POS,=MODE_TRADES );"
if (whatever is true){
close or whatever;
break;
}
}
Have your parameters for closing as if statements, you just go through the list regardless of where the position is, and close when you get to the trade you want to close, then break out of the loop.
Another method would be to store the trade number you want to close and then go through the list with the method above till your trade numbers match. Both are much better ways of doing it than trying to work out where the trades positions is in a list.
Yet another method is to comment your trade when you open it, then use the method above to go through the list and look for the comment.
If you use a loop, as in:
for (i= 0 ;i< OrdersTotal(),i++){
OrderSelect(i,SELECT_BY_POS,=MODE_TRADES );"
if (whatever is true){
close or whatever;
break;
}
}
Have your parameters for closing as if statements, you just go through the list regardless of where the position is, and close when you get to the trade you want to close, then break out of the loop.
Another method would be to store the trade number you want to close and then go through the list with the method above till your trade numbers match. Both are much better ways of doing it than trying to work out where the trades positions is in a list.
Yet another method is to comment your trade when you open it, then use the method above to go through the list and look for the comment.
*Penggunaan komersial dan spam tidak akan ditoleransi dan dapat mengakibatkan penutupan akun.
Tips: Memposting URL gambar/YouTube akan otomatis menyematkannya di postingan Anda!
Tips: Ketik tanda @ untuk melengkapi nama pengguna secara otomatis yang berpartisipasi dalam diskusi ini.