Is it a bug in Postion[index]? something seriously wrong
Is it a bug in Postion[index]? something seriously wrong
08 Aug 2016, 20:10
As you can find from the following pictures that the first postion is 23150115 based on the created time and so on. But when I run the cBot, I found the cBot didn't recognize the 23150115 as the first postion, instead it took the 23150728 as the first postion. So I wrote a code and printed them in the log. Then you can find from the log that the position number is not in a correct order.
can you tell me, is it a bug or something else wrong?
thank you very much
Replies
1015060
09 Aug 2016, 04:23
RE:
Dear moneybiz :
thank you for your replying, but I don't think the Symbol is the problem. As you can see I only opened 4 positions in total and they are all the same AUD/CAD pairs.
the problem is how could a third position become the first position?
Include also the Symbol of the Positions[index] to see better what you're looking for.
Since you'are not filtering the positions for a specific symbol it's possible that there are positions belonging to other instruments which you are not aware of.
@1015060
moneybiz
09 Aug 2016, 12:31
RE: RE:
1015060 said:
Dear moneybiz :
thank you for your replying, but I don't think the Symbol is the problem. As you can see I only opened 4 positions in total and they are all the same AUD/CAD pairs.
the problem is how could a third position become the first position?
I saw the 2nd image where there were EURUSD positions, for this I thought that you're not filtering them properly.
Anyway, I didn't test if index matches the entry time of the position but if that's really the case just order the positions by entry time to get what you want:
var positions = Positions.OrderBy(p => p.EntryTime).ToArray();
@moneybiz
1015060
09 Aug 2016, 13:00
RE: RE: RE:
Dear moneybiz:
Thanks for your replying again. Your way and code does work pefectly. I can adjust my code according to the EntryTime.
But I also want the cTDN technical staff to check whether there is a random bug or not inside the position[index]. If there is hope they can fix the problem, otherwise might cause a disaster in real live trading to those traders who using position[index] for coding.
thanks again
1015060 said:
Dear moneybiz :
thank you for your replying, but I don't think the Symbol is the problem. As you can see I only opened 4 positions in total and they are all the same AUD/CAD pairs.
the problem is how could a third position become the first position?
I saw the 2nd image where there were EURUSD positions, for this I thought that you're not filtering them properly.
Anyway, I didn't test if index matches the entry time of the position but if that's really the case just order the positions by entry time to get what you want:var positions = Positions.OrderBy(p => p.EntryTime).ToArray();
@1015060
1015060
08 Aug 2016, 20:39 ( Updated at: 21 Dec 2023, 09:20 )
It is confusing me. I test on other pair, then I found the postions' number is in right order this time. However when I test the AUD/CAD again, the problem still occur.
do anyone know what the problem might be? Does the problem take place randomly?
@1015060