Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,089 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Different BarPeriods #487483
05/12/23 21:08
05/12/23 21:08
Joined: May 2023
Posts: 4
T
tickserver Offline OP
Guest
tickserver  Offline OP
Guest
T

Joined: May 2023
Posts: 4
Hi,
I have a binary-option strategy that works quite well with BarPeriod=120. The problem is that run() is running now only at 0, 2, 4, 6... o'clock and I am missing additional trade opportunities at the full hours in between (1, 3, 5, ... o'clock).
I get the desired behavior by running my backtest once with BarOffset=0 and a second time with BarOffset=60. but I cannot find a way to put it together in one test-run.
I understand that changing BarOffset in run()-method does not work.
Next thing I tried was using BarPeriod=60 with TimeFrame=2 but this yields very different results (and even the documentation states that "...BarPeriod 60 and TimeFrame 1 is not the same as a script with BarPeriod 1 and TimeFrame 60...")

Any idea how to run a strategy based on H2-candles every hour (not only every 2 hours)?

Thx for your help!

Re: Different BarPeriods [Re: tickserver] #487488
05/15/23 13:46
05/15/23 13:46
Joined: Jul 2000
Posts: 27,987
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,987
Frankfurt
You need two overlapping time frames. Use BarPeriod = 60 and don't set Timeframe, but shift your series by script in alternating hours.

Re: Different BarPeriods [Re: jcl] #487779
09/12/23 23:10
09/12/23 23:10
Joined: May 2023
Posts: 4
T
tickserver Offline OP
Guest
tickserver  Offline OP
Guest
T

Joined: May 2023
Posts: 4
Thanks for your reply!
I followed you staying with BarPeriod = 60 but was not lucky with shifting my series.
The foilowing did the trick:

BarPeriod = 60;
TimeFrame = 2;
LifeTime = 4;
...
TimeFrame = 1;
enterShort();
TimeFrame = 2;

I basically switch to a shorter Timeframe just for when I enter my trade and switch back afterwards. Otherwise half of my trades would not be entered.
After lots of testing this seems to be proper workaround for what docu states: "Trades entered in the run function are not executed when the TimeFrame has not ended."


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