|
From: Josh T. <nli...@ya...> - 2011-04-10 23:29:48
|
All,
I'm back to coding chartsy starting this week. I will finish where I left off
with the TA-Lib integration and I will do the candle indicators next. I will
download the latest code tomorrow night.
I was thinking about how to efficiently use indicators in chartsy. It will be
important most especially for the candle indicator calculations. I think we have
a requirement that should read something like: "The chart shall update
indicators only once at each new time bar." The goal is to allow candlesticks to
update as needed but the indicators should only be calculated at the moment
of each new candle being created. The logical flow is something like:
if (Not New Time Bar){
update Timebar Data
}
else //it's a new time bar so....
{
update Timebar Data
update indicator data
}
It's not meant to be beautiful code but it's meant to show the idea. This should
be done because the indicator associated with any timebar is representative of
the complete calculation up to that bar. This means that whatever activity that
happens in that timebar is not calculated until that timebar ends and the new
timebar opens. Then the resulting indicator calculation is performed and the
result of all activity including the most recent timebar closure is represented
above the current active timebar. the complete calculation of an indicator above
any timebar is based on all the timebars before it only and does not include any
activity from the timebar with which it is associated.
Knowing this, we can insure that indicator calculations only happen once at the
beginning of the active timebar. I'm not sure Chartsy does this but I'm going to
investigate it to see if this has been considered already. This will greatly
enhance the ability of the AI framework (next on my list) to perform it's
functions and calculations without worrying about chart performance, CPU usage,
memory management, etc, etc. Some of the indicator calculations can be
monstrous.
I look forward to contributing again!
respectfully,
Josh |