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?
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.
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.
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)
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
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.