Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 8,381 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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: 49
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 49
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,840
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,840
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: 49
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 49
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: 49
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

Joined: Apr 2016
Posts: 49
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,840
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,840
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: 49
madpower2000 Offline OP
Newbie
madpower2000  Offline OP
Newbie

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


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1