>
>
> Issue:
> I ran some brute force optimization and found some profitable values which
> puts the effective "Period" of the EMA before I'd have enough samples to
> have a stable indicator. Example, my optimization selected 6700 (1.8
> hours).
>
> Hack solution: I can manually change my trading hours, I checked and it
> seems JBookTrader uses the trading hours properly for backtest, simulation,
> and live trading.
>
>
As I understand it, you are using an indicator which needs 1.8 hours to
"settle" before it can be used. Correct?
If so, the straightforward way to deal with it in JBookTrader when trading
(or forward testing, or simply collecting data), is to start running your
strategy at least 2 hours before the start of the trading period defined in
your trading schedule.
For example, let's say your trading strategy is this:
TradingSchedule tradingSchedule = new TradingSchedule("10:35", "14:55",
"America/New_York");
If you start running your strategy at 8:35, it would do everything that it
normally does (including crunching the market depth data, and updating your
indicators), but it would not initiate any trades before 10:35. Thus, your
indicator which needs 1.8 hours to settle would have enough time to be
"ready" by 10:35. Furthermore, JBookTrader is designed so that the code
takes the same path whether you are backtesting, optimizing,
forward-testing, or trading. So, if you started the strategy at 8:35 and
recorded the entire day, then a backtest and optimization would show
exactly the same results as your trading or forward-testing performance
(except for the slippage possibly encountered in live trading, which can go
either way).
Now, with regards to your proposed "ideal" solution (where each indicator
decides its own minimum settlement time), I had it implemented at some
point in time. There were three problems with that approach:
a) Indicator code is more complicated
b) Sometimes it's not clear what the settlement time should be
c) When a strategy uses more that one indicator each with its own
settlement time, it becomes rather confusing. Let's say indicator I1 needs
5 minutes, I2 needs 30 minutes, and I3 needs 1 hour. Ultimately, I3 should
win (in that my strategy should not be allowed to start trading until 1
hour of exposure to latest market data).
Your proposed solution would work, but to me it's
an unnecessary complication. With that you can probably understand now why
I chose this instead:
*public boolean hasValidIndicators() {
return (samples >= MIN_SAMPLE_SIZE);
}*
You simply set MIN_SAMPLE_SIZE to a value which is greater than the maximum
settlement period of any of your indicators.
Hope this makes sense. If not, feel free to ask.
Eugene.
--
You received this message because you are subscribed to the Google Groups
"JBookTrader" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jbooktrader?hl=en.