Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Nymphodora, Quad), 923 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Fractional LotAmount #484304
10/03/21 22:14
10/03/21 22:14
Joined: Aug 2021
Posts: 101
M
MegaTanker Offline OP
Member
MegaTanker  Offline OP
Member
M

Joined: Aug 2021
Posts: 101
Trying to simulate crypto assets, f.i. for BTC on Binance the minimum amount of BTC you can buy is 0.000001.
The manual says that fractional LotAmount is supported, but it doesn't seem to work for me. I set it to 0.000001 in the Assetlist and confirmed in the script using a watch statement that LotAmount is indeed that value right before trading, but then it still buys and sells a full Lot, the entire Bitcoin, which I can see in the log file. Using a simple enterLong/enterShort with the default Lots of 1.
What am I missing?

Last edited by MegaTanker; 10/03/21 22:15.
Re: Fractional LotAmount [Re: MegaTanker] #484305
10/04/21 09:03
10/04/21 09:03
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Maybe something about lot amounts and lots. One of them is fractional, the other isn't. Read the manual:

https://manual.zorro-project.com/lots.htm

Re: Fractional LotAmount [Re: MegaTanker] #484410
10/23/21 13:34
10/23/21 13:34
Joined: Oct 2021
Posts: 4
Singapore
A
Adrian_tama Offline
Guest
Adrian_tama  Offline
Guest
A

Joined: Oct 2021
Posts: 4
Singapore
I'm having the same issue as well. From what I understand, the number of assets/contracts to be traded is given by LotAmount * Lots. Currently, it seems that it does not take the LotAmount into account.

For example, if I set the LotAmount for SPX500 to be 0.1 (fractional), and I set the Lots to be 5, the trades in the log file open with 5 contracts, instead of 0.5. This also affects currencies, say with 1000 LotAmount. If I set Lots = 5, then the trades is opened with only 5 contracts, instead of 5000. This happens if I load a new AssetList. If I used the default one - AssetsFix.csv, the currency always gets a LotAmount of 1000 for some reason. I have ensured that the AssetList is loaded, and even the LotAmount is printed correctly in the log summary, i.e. in the entry "Contracts per lot". Just that the number of contracts opened is incorrect.

However, I'm quite new to the system, so I might have understood the calculations wrongly. I'm using Zorro free version 2.40, and I have read the link above. Thank you.

Re: Fractional LotAmount [Re: MegaTanker] #484425
10/24/21 16:08
10/24/21 16:08
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
When you open 5 SPX lots with 0.1 lotamount, you own half a SPX contract, not 5.

For some reason thinking in lots instead of contracts seems to confuse some, but its really simple. Just a multiplication.

Re: Fractional LotAmount [Re: MegaTanker] #484427
10/24/21 16:43
10/24/21 16:43
Joined: Aug 2021
Posts: 101
M
MegaTanker Offline OP
Member
MegaTanker  Offline OP
Member
M

Joined: Aug 2021
Posts: 101
I can add that I believe my problem was related to PIPCost. I set it equal to PIP (0.01 for BTC) but I guess it has to be multiplied by LotAmount aswell, so if LotAmount is 0.1, then PIPCost needs to be 0.1 * 0.01. Truth be told I am not sure if I understand PIPCost correctly, but that's as far as I got.

Re: Fractional LotAmount [Re: MegaTanker] #484432
10/25/21 15:58
10/25/21 15:58
Joined: Oct 2021
Posts: 4
Singapore
A
Adrian_tama Offline
Guest
Adrian_tama  Offline
Guest
A

Joined: Oct 2021
Posts: 4
Singapore
@Petra I would like to point out that, with your example, the number of contracts opened in my test script are 5, not 0.5. So, I guess there is a bug.

Not sure whether others experience the same issues.

Re: Fractional LotAmount [Re: MegaTanker] #484433
10/25/21 18:59
10/25/21 18:59
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
I would suggest that you read the Lots section in the manual and double check your assets file.

Re: Fractional LotAmount [Re: MegaTanker] #484438
10/26/21 00:23
10/26/21 00:23
Joined: Oct 2021
Posts: 4
Singapore
A
Adrian_tama Offline
Guest
Adrian_tama  Offline
Guest
A

Joined: Oct 2021
Posts: 4
Singapore
Asking someone to keep rereading the same documents and checking the same files might not be very useful to solve the issue.

Anyway, here I outline steps to reproduce the bug:
1. I created a new asset file with no cost, i.e. with all the Spread, RollLong, RollShort, MarginCost, and Commission set to zero. I have provided them as an attachment. This is to remove any costs associated with them, though it is not necessary to reproduce the bug.
2. I modified the Workshop4.c file, and add these 2 lines in the run function:
Code
 	assetList("AssetsNoCost");
	Lots = 1;

This is to set the lot size to be 1. I have also provided the file Workshop4_setLots.c as attachment.
3. I modified the LotAmount of EUR/USD in the AssetNoCost, and observe the following output in the logfiles.

For the LotAmount set to 1:
Code
Test Workshop4_setLots EUR/USD, Zorro 2.409

Simulated account   AssetsNoCost 
Bar period          1 hour (avg 86 min)
Total processed     52532 bars
Test period         2012-01-18..2017-12-29 (35990 bars)
Lookback period     300 bars (18 days)
Montecarlo cycles   200
Simulation mode     Realistic (slippage 5.0 sec)
Avg bar             17.5 pips range
Spread              0.0 pips (roll 0.00/0.00)
Contracts per lot   1.0

Gross win/loss      1.49$-0.95$, +5429.5p, lr 0.58$
Average profit      0.0913$/year, 0.0076$/month, 0.0004$/day
Max drawdown        -0.33$ 61.0% (MAE -0.34$ 62.7%)
Total down time     67% (TAE 95%)
Max down time       97 weeks from Nov 2015
Max open margin     0.0448$
Max open risk       0.18$
Trade volume        477$ (80.18$/year)
Transaction costs   0$ spr, -0.0210$ slp, 0$ rol
Capital required    0.28$

Number of trades    399 (68/year, 1/week)
Percent winning     24.3%
Max win/loss        0.10$ / -0.0528$
Avg trade profit    0.0014$ 13.6p (+153.8p / -31.4p)
Avg trade slippage  -0.00005$ -0.5p (+2.6p / -1.5p)
Avg trade bars      106 (+286 / -48)
Max trade bars      1165 (14 weeks)
Time in market      118%
Max open trades     4
Max loss streak     18 (uncorrelated 23)
...


For the LotAmount set to 10000:
Code
Test Workshop4_setLots EUR/USD, Zorro 2.409

Simulated account   AssetsNoCost 
Bar period          1 hour (avg 86 min)
Total processed     52532 bars
Test period         2012-01-18..2017-12-29 (35990 bars)
Lookback period     300 bars (18 days)
Montecarlo cycles   200
Simulation mode     Realistic (slippage 5.0 sec)
Avg bar             17.5 pips range
Spread              0.0 pips (roll 0.00/0.00)
Contracts per lot   10000.0

Gross win/loss      1.49$-0.95$, +5429.5p, lr 0.58$
Average profit      0.0913$/year, 0.0076$/month, 0.0004$/day
Max drawdown        -0.33$ 61.0% (MAE -0.34$ 62.7%)
Total down time     67% (TAE 95%)
Max down time       97 weeks from Nov 2015
Max open margin     0.0448$
Max open risk       0.18$
Trade volume        477$ (80.18$/year)
Transaction costs   0$ spr, -0.0210$ slp, 0$ rol
Capital required    0.28$

Number of trades    399 (68/year, 1/week)
Percent winning     24.3%
Max win/loss        0.10$ / -0.0528$
Avg trade profit    0.0014$ 13.6p (+153.8p / -31.4p)
Avg trade slippage  -0.00005$ -0.5p (+2.6p / -1.5p)
Avg trade bars      106 (+286 / -48)
Max trade bars      1165 (14 weeks)
Time in market      118%
Max open trades     4
Max loss streak     18 (uncorrelated 23)


Which, as you can see, are pretty much identical to each other, except for the line "Contracts per lot". With Lots set to 1, and for different LotAmount, this would have produced a different "Capital required", "Avg trade profit", etc (i.e. multiplied by the LotAmount). It's quite interesting that opening 10000 contracts of EUR/USD (for 1 lot) only manage to gain around 1 dollar in profit after a few years.

I have also provided another logfile, for the case of using the default asset list (AssetsFix), by removing/commenting on the assetList function (see below). Interestingly, in this scenario, the reported numbers are more reasonable, with values multiplied roughly by the LotAmount (1000 in this case), except for the associated trading costs.

Code
Test Workshop4_setLots EUR/USD, Zorro 2.409

Simulated account   AssetsFix 
Bar period          1 hour (avg 86 min)
Total processed     52532 bars
Test period         2012-01-18..2017-12-29 (35990 bars)
Lookback period     300 bars (18 days)
Montecarlo cycles   200
Simulation mode     Realistic (slippage 5.0 sec)
Avg bar             17.5 pips range
Spread              1.5 pips (roll -0.10/-0.11)
Contracts per lot   1000.0

Gross win/loss      1461$-1004$, +4565.9p, lr 489$
Average profit      76.78$/year, 6.40$/month, 0.30$/day
Max drawdown        -354$ 77.6% (MAE -367$ 80.4%)
Total down time     68% (TAE 96%)
Max down time       97 weeks from Nov 2015
Max open margin     0.0480$
Max open risk       177$
Trade volume        476803$ (80182$/year)
Transaction costs   -59.85$ spr, -20.95$ slp, -26.50$ rol
Capital required    252$

Number of trades    399 (68/year, 1/week)
Percent winning     21.6%
Max win/loss        103$ / -53.09$
Avg trade profit    1.14$ 11.4p (+169.9p / -32.1p)
Avg trade slippage  -0.0525$ -0.5p (+2.9p / -1.5p)
Avg trade bars      106 (+319 / -48)
Max trade bars      1165 (14 weeks)
Time in market      118%
Max open trades     4
Max loss streak     18 (uncorrelated 27)

[/code]

Attached Files
AssetsNoCost.csv (138 downloads)
Workshop4_setLots.c (152 downloads)
Re: Fractional LotAmount [Re: MegaTanker] #484444
10/26/21 10:36
10/26/21 10:36
Joined: Apr 2008
Posts: 585
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 585
Austria
Look here how to correctly set up a lot amount in the asset list:

https://manual.zorro-project.com/account.htm

On that page you can see many examples for assets with different lot amounts. You cannot just make up a lot amount because it affects other parameters. Either use the parameters from your brokers website, or just one of the included asset lists.

Otherwise, well you now found out what you then get: garbage in, garbage out wink

Re: Fractional LotAmount [Re: MegaTanker] #484452
10/26/21 14:39
10/26/21 14:39
Joined: Oct 2021
Posts: 4
Singapore
A
Adrian_tama Offline
Guest
Adrian_tama  Offline
Guest
A

Joined: Oct 2021
Posts: 4
Singapore
Thanks for the link. I have taken a look at the examples, and it's clear to me that what lot amount does is just multiplication.

From my example above, I have shown that the simulated trading results are not affected by the lot amount variable, as if it is doing nothing. I understand that the lot amount variable affects other cost variables as well, and that's why I created a special asset list to show that the trading result does not respond to the lot amount at all.

I cannot make this clearer, but how much effort would it take for you (or anyone else) to take a careful look at my example, and comment why the simulated result would be expected.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1