Gamestudio Links
Zorro Links
Newest Posts
Chart Viewer Timeframe
by mcl. 09/27/23 01:44
How many still using A8
by NeoDumont. 09/26/23 22:59
Lapsa's very own thread
by M_D. 09/26/23 15:47
Zorro MT5 Bridge
by AndrewAMD. 09/26/23 13:55
Shuffle Millionaire
by Akim. 09/25/23 09:38
Python file interface
by soulman3. 09/24/23 16:59
ZeroMQ
by soulman3. 09/24/23 16:17
For Germans Only - About the Scholz Tax
by steyr. 09/22/23 19:20
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (matjik, Martin_HH, Quad), 1,066 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
mcl, h725, Akim, SoftKill, LBABJB
18993 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: 2
T
tickserver Offline OP
Guest
tickserver  Offline OP
Guest
T

Joined: May 2023
Posts: 2
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,963
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,963
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: 2
T
tickserver Offline OP
Guest
tickserver  Offline OP
Guest
T

Joined: May 2023
Posts: 2
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