Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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