Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 600 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to reset the look back period at the beginning of a session? #487147
01/28/23 19:24
01/28/23 19:24
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
I am trying to play around with some kind of market making HFT-style trading algo for futures.
And stuck on the problem, how to reset the look back period at the beginning of the trading session every day. I would be grateful for a code snippet.

Last edited by madpower2000; 01/28/23 19:33.
Re: How to reset the look back period at the beginning of a session? [Re: madpower2000] #487148
01/28/23 20:27
01/28/23 20:27
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
is(NEWDAY) will tell you when you have a new day. Pause sending trading signals until enough bars have passed. Voila, you have enough lookback for the day.

Re: How to reset the look back period at the beginning of a session? [Re: madpower2000] #487151
01/29/23 06:20
01/29/23 06:20
Joined: Apr 2019
Posts: 53
Canada
A
aelagha Offline
Junior Member
aelagha  Offline
Junior Member
A

Joined: Apr 2019
Posts: 53
Canada
Would that be a new trading day or new calendar day (i.e. if BR_FLAT is used)? thx

Re: How to reset the look back period at the beginning of a session? [Re: aelagha] #487156
01/29/23 08:48
01/29/23 08:48
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
Unfortunately, I can't understand what do you mean?

Re: How to reset the look back period at the beginning of a session? [Re: AndrewAMD] #487157
01/29/23 09:01
01/29/23 09:01
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
What a simple DIY solution! I'm tearing my hair out - how I couldn't think of it myself! 🙂
My first assumption was I miss some kind of hidden Zorro feature in the docs.
Thank you for the hint!

But in my case NEWDAY in a strange way was firing on every bar.
Code
if(NEWDAY) printf("\nIt's new day!");

I don’t know if this is a bug or a feature…
But
Code
if(at(1010))  printf("\nIt's new day!");
Do the trick!

Re: How to reset the look back period at the beginning of a session? [Re: madpower2000] #487158
01/29/23 14:38
01/29/23 14:38
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Not NEWDAY, is(NEWDAY).

Re: How to reset the look back period at the beginning of a session? [Re: AndrewAMD] #487159
01/29/23 14:42
01/29/23 14:42
Joined: Apr 2016
Posts: 38
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 38
Oh, thanks again!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1