Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, 7th_zorro, 1 invisible), 1,060 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with CFDs: Series are running even when market is closed #442195
06/15/14 12:39
06/15/14 12:39
Joined: Apr 2014
Posts: 18
molloy Offline OP
Newbie
molloy  Offline OP
Newbie

Joined: Apr 2014
Posts: 18
Hi,

I experienced very big difference in behavior of my scripts in live trading and backtesting the same period later. Unfortunately the difference caused loss, not profit. frown

I think that the problem is with CFD market open hours: Zorro knows nothing about this, so bars are opened during night while the market is closed. Series get filled with the same data and this gap causes problems, e.g. lowpass filters change direction too early.

Although my script does nothing when the market is closed, I must fill the series because this is needed by Zorro.

Interestingly, when I download the data from fxcm with the download script and run a backtest, there are no bars during the night.

I have no idea what to do except that I have to stop using series.

Thank you for your help in advance!

Krisztián

-------

Some more detail:

Log from live (removed some lines logged by other components):
[Fri 13.06. 02:58] 1080 -113 +5 /\\
[Fri 13.06. 03:58] 1080 -113 +5 /\\
[Fri 13.06. 04:58] 578 -113 +5 /\\
[Fri 13.06. 05:58] 581 -113 +5 /\\
[Fri 13.06. 06:58] 516 -174 +4 /
[Fri 13.06. 07:58] 532 -174 +29 /
[Fri 13.06. 08:58] 529 -174 +28 /
[Fri 13.06. 09:58] 550 -174 +44 /
[Fri 13.06. 11:00] 548 -129 +0
Lowpass Short Invested Capital: 1095, on 6/13
[GER30:lowpass:S1819] Short 11@9843 Risk 39 t at 10:59

The same period from a backtest:
[1056: Thu 12.06. 21:59] 9910.00
[1057: Fri 13.06. 06:59] 9910.00
[1058: Fri 13.06. 07:59] 9926.00
[1059: Fri 13.06. 08:59] 9881.00
[1060: Fri 13.06. 09:59] 9883.00
[1061: Fri 13.06. 10:59] 9850.00
[1062: Fri 13.06. 11:59] 9842.00
[1063: Fri 13.06. 12:59] 9853.00
[1064: Fri 13.06. 13:59] 9880.00


Part of the code of my lowpass component which is the most affected one by this problem (although equity curve trading logic in other components is also heavily affected):


function tradeLowPass() {
algo("lowpass:S");
Stop = 22 * PIP;
Margin = margin * 3;
Trail = 0;
ExitTime = 18;
vars Price = series(price());
vars lowPass = series(LowPass(Price, 600));
vars lowPass2 = series(LowPass(Price, 760));
vars lowPass3 = series(LowPass(Price, 100));

if (isTradingHour() and falling(lowPass2) and falling(lowPass) and falling(lowPass3) and not opened) {
Lots = 1;
enterShort(0, 0, 25, 0, 30, 115);
opened = 1;
openedAt = price();
}
...
}

Re: Problem with CFDs: Series are running even when market is closed [Re: molloy] #442213
06/16/14 06:18
06/16/14 06:18
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
This also happens when the market is not closed, but no price quotes arrive during a bar period. There are two solutions. You can either generate bars even without quotes in the backtest, or you can skip bars without quotes in trade mode.

For the first solution, select a 24 hours asset such as EUR/USD before selecting the CFD. The first selected asset determines the bars.

For the second case, use the TimeFrame mechanism to skip bars when their price is identical to the previous bar or when the time is outside market hours.

Re: Problem with CFDs: Series are running even when market is closed [Re: jcl] #442223
06/16/14 07:55
06/16/14 07:55
Joined: Apr 2014
Posts: 18
molloy Offline OP
Newbie
molloy  Offline OP
Newbie

Joined: Apr 2014
Posts: 18
Hi jcl,

thank you for the answer, I will try the second solution!


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1