How to reset the look back period at the beginning of a session?

Posted By: madpower2000

How to reset the look back period at the beginning of a session? - 01/28/23 19:24

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.
Posted By: AndrewAMD

Re: How to reset the look back period at the beginning of a session? - 01/28/23 20:27

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.
Posted By: aelagha

Re: How to reset the look back period at the beginning of a session? - 01/29/23 06:20

Would that be a new trading day or new calendar day (i.e. if BR_FLAT is used)? thx
Posted By: madpower2000

Re: How to reset the look back period at the beginning of a session? - 01/29/23 08:48

Unfortunately, I can't understand what do you mean?
Posted By: madpower2000

Re: How to reset the look back period at the beginning of a session? - 01/29/23 09:01

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!
Posted By: AndrewAMD

Re: How to reset the look back period at the beginning of a session? - 01/29/23 14:38

Not NEWDAY, is(NEWDAY).
Posted By: madpower2000

Re: How to reset the look back period at the beginning of a session? - 01/29/23 14:42

Oh, thanks again!
© 2024 lite-C Forums