Gamestudio Links
Zorro Links
Newest Posts
Gaussian Crash Error (Solved)
by TipmyPip. 07/26/24 13:21
Eigenwerbung
by Tails01. 07/25/24 11:04
Zorro Trader GPT
by TipmyPip. 07/20/24 06:46
Delaying Exit Order
by AndrewAMD. 07/17/24 11:38
Lapsa's very own thread
by rki. 07/14/24 16:39
LINUX Debian & Zorro problems
by juergen_wue. 07/13/24 07:15
Placing Order during Market Close
by jcl. 07/12/24 13:57
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (TipmyPip), 920 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rramsey, Erasand, Cristoig2001, Mino, squik
19064 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,990
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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