|
Re: for(all_trades) inverse order
[Re: MatPed]
#470606
01/24/18 13:08
01/24/18 13:08
|
Joined: Feb 2017
Posts: 369
Dalla
Senior Member
|
Senior Member
Joined: Feb 2017
Posts: 369
|
Depends what exectly you are after. These arrays contain the results for the 20 most recent trades. index 0 = most recent trade. ResultLong[0] .. ResultLong[19] ResultShort[0] .. ResultShort[19] More info http://zorro-trader.com/manual/en/winloss.htm
|
|
|
Re: for(all_trades) inverse order
[Re: Dalla]
#470607
01/24/18 13:42
01/24/18 13:42
|
Joined: Feb 2015
Posts: 652 Milano, Italy
MatPed
OP
User
|
OP
User
Joined: Feb 2015
Posts: 652
Milano, Italy
|
Thank You Dalla, that was exactly my starting point, but it did not work. I want to calculate the Rolling Expectancy Ratio. Basically I need the Result of the last N trades the mentioned arrays does not provide such information. the for(all_trade) macro could be used, but unfortunately its sort the trades from the first opened one. Reversing a growing array is not trivial for my coding capabilities, so I was blessing for some help . Ciao
|
|
|
Re: for(all_trades) inverse order
[Re: jcl]
#470617
01/25/18 09:12
01/25/18 09:12
|
Joined: Feb 2015
Posts: 652 Milano, Italy
MatPed
OP
User
|
OP
User
Joined: Feb 2015
Posts: 652
Milano, Italy
|
Thank you, For the specific task only closed would be enough. For general purposes I guess that all trades would be better. I know that this will be an easy task for you, but when you write it can you explain of how it works?
I've tried to read the for(all_trade) macro definition but, I admit, is quite obscure to me...
Ciao
Last edited by MatPed; 01/25/18 09:17.
|
|
|
Re: for(all_trades) inverse order
[Re: MatPed]
#470626
01/25/18 13:51
01/25/18 13:51
|
Joined: Jul 2017
Posts: 783
Zheka
User
|
User
Joined: Jul 2017
Posts: 783
|
- Zorro seems to maintain one single list of all trades in a portfolio. Will it make sense to add a field to Trade struct with a pointer to the previous trade of the same algo/asset component? Then traversing such a linked list backwards for a component would be quicker, and such backwards looping is mostly needed for a component, not the full portfolio. - break_trades for some reason does not work; break- does It would really help if Zorro exposed a variable/pointer to the last closed trade of the current asset/algo combination (without asking a user to go into the for(trades)loop. Or is there a way?
|
|
|
Re: for(all_trades) inverse order
[Re: MatPed]
#470639
01/26/18 09:57
01/26/18 09:57
|
Joined: Jul 2017
Posts: 783
Zheka
User
|
User
Joined: Jul 2017
Posts: 783
|
Hi, MatPed, Suggestion to extend a Trade struct was to improve speed and flexibility of looping - both internally by Zorro and/or for a user; with or without a for()macro. Did you already tried for(closed_trades)with version 1.78 and discovered a bug using break_trades ? Yes, I did. A simple for(closed_trades)loop with a counter to print details of last 20 trades only printed for 1 trade with break_trades and all 20 with a normal break. If more complex scenaria would work properly with a normal "break" - I did not test.
|
|
|
|