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
1 registered members (opm), 778 guests, and 4 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
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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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