long time = getMarketBook().getSnapshot().getTime();
Calendar calendar =
Calendar.getInstance(TimeZone.getTimeZone("America/New_York"));
calendar.setTimeInMillis(time);
int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY);
int minuteOfHour = calendar.get(Calendar.MINUTE);
On Sat, Dec 14, 2013 at 3:55 AM, toughluck <[email protected]> wrote:
> Is there a good way in a strategy to know when the strategy just started
> for the day?
>
> For example, if I have a peak finding strategy, it will only kick in a buy
> at the peak, but at the beginning of the trading session, the peak already
> passed and the price is already trending so I should recognize the upward
> trend and place the buy right at open.
> I tried using isDisabled as a flag, but I cant see when its turned off,
> since onBookSnapshot is not called, so it only works for the first day.
>
> I general I would like to use something like this which resets for the
> next day:
>
> if (trading_just_started) {
> // Run special start-up version of strategy
> trading_just_started = false;
> } else {
> // Run the regular strategy
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "JBookTrader" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/jbooktrader.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jbooktrader.
For more options, visit https://groups.google.com/groups/opt_out.