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 beg to disagree with you guys.... remember that I am filtering OrdersTotal() by using this condition:
&& ((OrderProfit() + OrderSwap() + OrderCommission())) > 0)
If there are 10 Orders... and 5 of them are positive ie. 5 "Winning" trades.... and I run the first loop
i = 10
NoTradesBest = 5
....when I run the second loop:
i = 5
Yes...BUT, there are only 5 "winning" Trades/Orders (as calculated by the first loop).... so, I am not cutting off any positive "winning" trades... I'm still using the condition:
&& ((OrderProfit() + OrderSwap() + OrderCommission())) >= 0)
Well, I hope that is the bug you are referring too....
Out of the 10 Orders... with 5 being positive (> $0) - the BestPositionArray will (and is) populated with the data of 5 Orders.... all of which are positive
Anyways, thanks for at least making me think about it... If I'm being an idiot here and still missing it... then please let me know... but I think it's right - well, it is right if I check the array
I beg to disagree with you guys.... remember that I am filtering OrdersTotal() by using this condition:
If there are 10 Orders... and 5 of them are positive ie. 5 "Winning" trades.... and I run the first loop
i = 10
NoTradesBest = 5
....when I run the second loop:
i = 5
Yes...BUT, there are only 5 "winning" Trades/Orders (as calculated by the first loop).... so, I am not cutting off any positive "winning" trades... I'm still using the condition:
Well, I hope that is the bug you are referring too....
Out of the 10 Orders... with 5 being positive (> $0) - the BestPositionArray will (and is) populated with the data of 5 Orders.... all of which are positive
Anyways, thanks for at least making me think about it... If I'm being an idiot here and still missing it... then please let me know... but I think it's right - well, it is right if I check the array
It can be or not depending on which orders are in profit, but most probably is it is NOT. If that's the 5 first (last as you count down), all will be ok. If not your array will not be correctly filled.
Example :
You correctly count the "winners" = 5 in No_Best_Trades(), but then in Populate_Best_Position_Array() you loop from 4 to 0 : you are missing the orders indexed 9,8 and 6. You need to loop ALL the orders.
I've written a simple script (bottom) to illustrate the results you'll get given different sequence of orders (in this illustration I just use OrderProfitsn[] to represent that). Run it, and you'll see this result:
Coded properly (the yellow ones), you get the right results always... but coded like yours, you'll only get right results when the inputs are already sequenced (by luck) in certain way.
Script:
Edit: "Ideal" solution for illustration only... actual/final solution requires additional safety checks :)