I have a quick thought, and since I'm new I just wanted to throw it out
there to see if it has been discussed as a feature or maybe there is some
other way to handle this condition.
1. I am backtesting a custom strategy which uses something like the
example Tension indicator.
2. The version of Tension that I am using (details are not that important
for this discussion), ends up using a EMA pattern that I see a lot, which
uses a multiplier, based on a period. I had to read the wikipedia article
on the math to see why this += trick works, but that is another topic too.
3. My market day is default, starts at 10:35am, in base class of
StrategyES.
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.
Strategy Based Solution:
My strategy can know this is not ready, and simply not trade. Ok, that is
pretty easy, but I think people might not really think of this pitfall for
every strategy they might write. From an object oriented perspective, it
is the Indicators job to know if it is ready or not.
Ideal Solution:
Maybe the abstract Indicator class can have an optional override (default
returns true), which says that the indicator has enough data to be valid?
Now, then there is the question of who calls this. Perhaps
IndicatorManager (who already seems to have generic logic for this hard
coded), could call this on every Indicator right here:
public boolean hasValidIndicators() {
return (samples >= MIN_SAMPLE_SIZE);
}
As currently MIN_SAMPLE_SIZE is hard coded at 1hr. So my idea would be to
interrogate each Indicator to see if it is ready, rather than waiting the
hard coded 1hr.
I so new to this, I only want to make changes that people think are ready
relevant. As a newbie, many of my ideas may come from just not
understanding what is important to solve.
Thoughts?
Also, If I come up with an improvement or bug fix, is there a process to
submitting a patch?
Marcus
--
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.