Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (PeWi, AndrewAMD, Quad, VoroneTZ), 463 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: Micro lot trading [Re: Chaosfreak] #425907
07/12/13 12:31
07/12/13 12:31
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
Thanks! That makes perfect sense to adjust the .mq4 script instead. I will go ahead and do this laugh

Re: Micro lot trading [Re: dusktrader] #425917
07/12/13 15:13
07/12/13 15:13
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
(SIDENOTE: in looking at the Zorro.mq4 script, it seems that broker suffixes are handled automatically, so there is nothing needed to be changed here)

Ok, I tried to do this and it "may" have worked. Can you please look at the attached file here and answer a few questions for me?

The first time I ran the Download script, it produced several errors saying pairs were not available (some were, some weren't). I assumed this was due to the pairs not being available on FXCM's datafeed. At the conclusion of the script run, it crashed Zorro.

So I restarted Zorro with the -diag switch and tried again. However, on this second run, it went through every pair in the loop and said it was successful (see attached Assets.dta file) (SIDENOTE: the reason for the initial crash "could" have been that the MT4 demo platform was a brand-new install, most pairs had never been opened even once. The reason for this is because I never use demo platforms, only live. This theory could explain why the 2nd run of the script was able to identify every pair requested.)

I have a couple questions now:
1) The pairs that IBFX uses do not have a slash between the instrument (ie, EURUSD instead of EUR/USD). My question is, will Zorro handle this correctly, or do I need to tell the Zorro.mq4 script to translate them to have the slash? My understanding is that pricing will be coming from the FXCM datafeed when using the MT4 plugin.

2) Presumably I will need to remove the default Zorro assets that are currently still in the Assets.dta file attached here (for example EUR/USD is the default to be removed, whereas EURUSD is the IBFX-downloaded asset)

Once I get this Assets.dta file cleaned up/correct, I'll post it back here for others who may want it. These assets represent all the live-tradeable assets on a US-based IBFX mini platform (I downloaded them from the demo, but I only included the ones available on live platform)

THANKS

Attached Files
Download_IBFXmini.zip (92 downloads)
Assets.dta and script
Re: Micro lot trading [Re: dusktrader] #425918
07/12/13 16:16
07/12/13 16:16
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
Ok, I've verified that all of the live-tradeable IBFX pairs are also available on the FXCM datafeed (from here: http://www.fxcm.com/products/forex/currency-pairs )

So I believe I only need to determine whether or not the Assets.dta and AssetsFix.dta need to be in the FXCM format with the slash (ie, EUR/USD) or if it is acceptable to leave them in the IBFX format (ie, EURUSD)

If the slash is required, then it should just be a few simple changes to the Zorro.mq4 script as noted above.

How should I go about acquiring history testing data from FXCM datafeed for the remaining pairs? On IBFX there are 27 pairs that I follow. Is there a place to download individual tickdata for each pair from IBFX? If not I can get it from another source, but I prefer to keep it consistent as possible.

Re: Micro lot trading [Re: dusktrader] #425925
07/12/13 18:59
07/12/13 18:59
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
I'm still tinkering around with this and have learned the following:

1) apparently it does matter -- Zorro wants the Assets.dta and AssetsFix.dta pairs to include the slash (ie, EUR/USD). When I attempted to train/test my strategy, it did manage to find the pairs when I had removed all the slashes from Assets.dta, but it then proceeded to add them back as additional instruments with the slash in the name. So I've reset the Assets.dta and AssetsFix.dta to include only the IBFX instruments, and all listed with the slash. Presumably, I need the translation code added to the top of the Zorro.mq4 script based on this.

2) however, now I'm confused. After updating the Assets.dta files and retraining/testing my script... it now shows dramatically different results (including an ulcer index over 2000% YIKES!) So it seems something is not right here. And it definitely has to do with this change to Assets.dta and AssetsFix.dta I believe -- I see no other changes to actual history files here.

Also, before changing the .dta files, I made a complete backup of the entire Zorro History folder. If I swap back in the old history folder, my script tests as expected. As soon as I swap back to the new .dta files, the performance gets screwy.

I'm attaching my BEFORE and AFTER .dta files here... maybe this will have some clues?

THANKS


EDIT: I'm attaching also results from a strategy I've been playing with from the forum... the ONLY change between these results is swapping the Assets.dta files... I'm "expecting" the results to be somewhat similar, but they're not.

Attached Files
Assets -- BEFORE, should be default.zip (115 downloads)
BEFORE (should be Zorro defaults)
Assets -- AFTER.zip (103 downloads)
AFTER modifying for IBFX mini
results.zip (101 downloads)
Test results
Last edited by dusktrader; 07/12/13 19:45.
Re: Micro lot trading [Re: dusktrader] #426021
07/15/13 12:36
07/15/13 12:36
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
Here are some more simple results to look at, from the default Workshop4_1.

I'm trying to determine if this is normal/correct, or if there is some problem. What are the reasons that could cause this situation between my IBFX mini account and the default Zorro settings?

One thing that seems unusual is the 'Lot' column in my IBFX Assets.dta file. If this is incorrect, could it indicate a glitch in the Download.c script and/or the Zorro.mq4 script?

Here are the Workshop4_1 test results comparing the default Assets.dta with the IBFX-downloaded version:

Default Zorro settings
Code:
BackTest Workshop4_1 EUR/USD - performance report

Test period         10.01.2008-10.06.2013
Lookback time       141 bars (5 days)
Assumed slippage    10.0 sec
Assumed spread      2.4 pips (roll -0.10/0.02)
Contracts per lot   746

Gross win/loss      1464$ / -1004$ (+6167p)
Average profit      85$/year, 7.08$/month, 0.33$/day
Max drawdown        -137$ 30% (MAE -169$ 37%)
Total down time     71% (TAE 98%)
Max down time       71 weeks from Jun 2009
Largest margin      10$
Trade volume        432293$ (79819$/year)
Transaction costs   -76$ spr, -4.47$ slp, -6.71$ rol
Capital required    112$

Number of trades    424 (79/year, 2/week, 1/day)
Percent winning     18%
Max win/loss        216$ / -14$
Avg trade profit    1.09$ 14.5p (+19$ / -2.89$)
Avg trade slippage  -0.01$ -0.1p (+0.04$ / -0.06$)
Avg trade bars      83 (+358 / -22)
Max trade bars      2106 (18 weeks)
Time in market      105%
Max open trades     2
Max loss streak     18 (uncorrelated 33)

Annual return       83%
Profit factor       1.46 (PRR 1.23)
Sharpe ratio        0.62
Kelly criterion     0.50
OptimalF            .032
Ulcer index         16%
Prediction error    41%

Portfolio analysis  OptF  ProF  Win/Loss

EUR/USD:L           .027  1.25   41/171   
EUR/USD:S           .038  1.66   36/176



IBFX settings acquired from Download.c
Code:
BackTest Workshop4_1 EUR/USD - performance report

Test period         10.01.2008-10.06.2013
Lookback time       141 bars (5 days)
Assumed slippage    10.0 sec
Assumed spread      2.0 pips (roll -0.05/0.04)
Contracts per lot   100

Gross win/loss      194$ / -140$ (+5394p)
Average profit      9.96$/year, 0.83$/month, 0.04$/day
Max drawdown        -22$ 42% (MAE -28$ 52%)
Total down time     72% (TAE 98%)
Max down time       92 weeks from May 2011
Largest margin      5.22$
Trade volume        57948$ (10700$/year)
Transaction costs   -8.48$ spr, -0.60$ slp, -10$ rol
Capital required    55$

Number of trades    424 (79/year, 2/week, 1/day)
Percent winning     18%
Max win/loss        33$ / -1.92$
Avg trade profit    0.13$ 12.7p (+2.58$ / -0.40$)
Avg trade slippage  -0.00$ -0.1p (+0.00$ / -0.01$)
Avg trade bars      83 (+350 / -25)
Max trade bars      2106 (18 weeks)
Time in market      105%
Max open trades     2
Max loss streak     24 (uncorrelated 34)

Annual return       20%
Profit factor       1.39 (PRR 1.16)
Sharpe ratio        0.54
Kelly criterion     1.60
OptimalF            .294
Ulcer index         18%
Prediction error    41%

Portfolio analysis  OptF  ProF  Win/Loss

EUR/USD:L           .000  0.67   31/181   
EUR/USD:S           .294  2.27   44/168


Re: Micro lot trading [Re: dusktrader] #426028
07/15/13 13:26
07/15/13 13:26
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
Ok in further digging, I believe this is related to the LotFactor being set by Zorro.mq4. I did a quick test and it seems that IBFX is returning 0.01 for the MODE_MINLOT value.

If I force the LotFactor to be 0.1, then I get a Lot setting in Assets.dta of 1000 which gives the backtest similar results to your defaults.

So at this point I'm just trying to determine what other factors could be involved (ie, a glitch?) that could cause the detrimental results.

Presumably, if I force the Lot to 1000 in Assets.dta, but keep all the rest of the figures the same for IBFX, then Zorro would simply trade with a higher lot size than the broker minimum. However, it would be ideal to trade microlots at a minimum of 0.01 units.

THANKS laugh

PS: Let me know what else I can do on my end, to help you further investigate.

Re: Micro lot trading [Re: dusktrader] #426073
07/16/13 07:44
07/16/13 07:44
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
The reason is a Zorro bug which only affects tests with a low drawdown value, less than $100.

The return is calculated from the drawdown, and for this Zorro adds the minimum margin to the drawdown. That's ok so far, but as the minimum margin depends on the asset, it uses an average value of $50 which is too high for your nano lot account. This makes all tests with low drawdown too pessimistic. Another user had a similar problem.

This will be fixed in the next Zorro version. Until then, when you simulate different accounts, use a high margin or lot size to keep the drawdown high enough so that the additional $50 don't noticably drag down the annual return.

Re: Micro lot trading [Re: jcl] #426081
07/16/13 10:27
07/16/13 10:27
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
That's great to hear (it means I'm not really going insane then!) Actually it's good to know this is a known issue, I like them better because they're easier to fix!

Can you answer me this please: what is the effect if I simply force the MODE_MINLOT value to be 0.1 instead of 0.01? In other words, if I simply change Assets.dta to have a lot of 1000, instead of 100?

I'm hoping you will say: that's fine, it just means that Zorro's minimum lot size will be bigger than your account can actually do. But for the purpose of accurate backtesting, this should be fine.

Separately, can you please confirm that your default Assets.dta files are configured for an account with deposit currency of EUR? I believe this might be the case. I'm guessing it might have "some" effect on example strategies, but hopefully not significant (as compared to what I'm getting from my USD broker).

THANKS

Re: Micro lot trading [Re: dusktrader] #426092
07/16/13 14:35
07/16/13 14:35
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
You have to change AssetsFix.dta in that case - Assets.dta is for storing the current account data, while AssetsFix.dta is the account used in the simulation.

Setting Lots to 1000 should work. But you must then also set PipCost to a 10x higher value.

Yes, the default account is a micro lot EUR account, with a lot size of 1000 contracts.

Re: Micro lot trading [Re: jcl] #426101
07/16/13 16:16
07/16/13 16:16
Joined: Jul 2013
Posts: 522
D
dusktrader Offline
User
dusktrader  Offline
User
D

Joined: Jul 2013
Posts: 522
While I wait for the next Zorro version (that can hopefully fix the stats issue with nano accounts)... can you please confirm:

it seems that a very simple workaround I could do is to simply boost the number of (flat) Lots in my script, to make them above the threshold of the bug.

For example, if I just add "Lots = 10;" to the Workshop4_1 script while using my IBFX-downloaded Assets.dta and AssetsFix.dta files, the results may be correct.

I think the variance between the default Zorro Assets.dta file could just be the fact that my file is representing a USD deposit currency:

default Zorro Asset.dta Workshop4_1 result (EUR deposit currency):
Code:
Workshop4_1 compiling...............
Lookback set to 141 bars
BackTest: Workshop4_1 EUR/USD 2008..2013
Profit 460$  MI 7$  DD 137$  Capital 112$
Trades 424  Win 18%  Avg +14.5p  Bars 83
AR 83%  PF 1.46  SR 0.62  UI 15.9%  Error 41%



IBFX-US nano account (USD deposit currency):
(while also adding Lots = 10; in the script)
Code:
Workshop4_1 compiling...............
Lookback set to 141 bars
BackTest: Workshop4_1 EUR/USD 2008..2013
Profit 539$  MI 8$  DD 224$  Capital 219$
Trades 424  Win 18%  Avg +127.2p  Bars 83
AR 60%  PF 1.39  SR 0.54  UI 18.2%  Error 41%



I like this simpler fix/workaround (if you agree) and would like to be able to put this issue to bed. I don't care too much about $ values, I'm more concerned with accurate percentages.

THANKS

Page 3 of 4 1 2 3 4

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1