PureBytes Links
Trading Reference Links
|
We do a lot of this kind of thing in C++, where we have this variable
called 'Adjust'. This is basically what we need to chop off from the
start of the time series to get the calcs to work, ie ignore the first
200 days if one indicator is a 200 day moving average. If you then
calculate a 50 day moving average of the 200 day moving average, you
increase Adjust by another 50, and so keep on stacking up until you
are done with the calcs. I get the idea you are doing something
similar. What we decided to do, was to make this 'Adjust' always work
from the start of the time series, not the start of some indicator.
Now, any way should work, but it seems you want to make 'Adjust' work
from the start of the moving average.
Either way has its benefits and drawbacks. If you adjust from the
start, then you need to stack up your adjustment as long as you keep
on calculating, but it does not matter if you change the indicator
that the system is anchored to. If you adjust from the indicator, it
makes the adjustment calculation easier, but it depends on the
indicator. Say you want to one day replace your moving average with
some fancy new formula. Then it may be better to adjust from the start.
Anyhow, I'd suggest you at least consider adjusting from the start
rather than from the start of some indicator, as this introduces
complexities if you change the indicator.
Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com
--- In equismetastock@xxxxxxxxxxxxxxx, "robcpettit" <robcpettit@xxxx>
wrote:
> Thankyou for your reply, If Im understanding this correctly this solve
> a niggling problem. Ive been using Cum buy not in the way youve
> pointed out. The count kept starting from from day one of data and not
> of m/a, therefore I had to combine with the lastvalue method to get
> around this. From what youve given here I can Count from day one of
> m/a providing I have 200 prices, or what ever the moving Average is.
> Thankyuo
> Regards Robert
>
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" <quant@xxxx> wrote:
> > Hi Robert,
> >
> > I think a lot of your questions can be answered by the 'Cum(1)'
> > function, which simply counts from 1 onwards. So if your formula
> > should only kick in if you have 300 data points, something like
> >
> > Cum(1) >= 300
> >
> > will only return true if that condition is met. You can parameterise
> > it easily, say
> >
> > Cum(1) >= par1
> >
> > To count the number of bars a given formula is available, say a moving
> > average, you can use something like
> >
> > Cum(Mov(C,200,S)>0)
> >
> > which will count the number of days this formula was above 0. So if
> > you work with things that can also take on negative values, you have
> > to adjust accordingly, but the idea is the same. This only starts
> > counting once the formula 'works', ie after the first 200 days are
> > available.
> >
> > Hope this helps. If all else fails, use exponential averages, which
> > theoretically start working from day 1 (although I have a feeling MS
> > may treat it differently).
> >
> > Regards
> > MG Ferreira
> > TsaTsa EOD Programmer and trading model builder
> > http://www.ferra4models.com
> > http://fun.ferra4models.com
> >
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "robcpettit" <robcpettit@xxxx>
> > wrote:
> > >
> > >
> > > Thanks for your reply. Ok clarity. Im calculating the difference
> > > between the average and the dailly price. so if say i have 300
prices
> > > and use the 200 dma I would be able to calculate 100
differences. When
> > > I have these 100 values I want to add them all together. Fairly
> > > straight forward when I know excactly how many values I need to add.
> > > But on a dailly basis I will be adding new data so realistically I
> > > cant do this manually. Therefore I need a formula to say 'you
have 100
> > > values' which Ill then use in a variable to do the rest. Also I want
> > > to very my moving averages so again impossible to do manually. I
hope
> > > this is explained better.
> > > Regards Robert
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|