[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Higher timeframe indicator on a lower timeframe chart


  • To: omega-list@xxxxxxxxxx
  • Subject: Re: Higher timeframe indicator on a lower timeframe chart
  • From: "Gary Fritz" <fritz@xxxxxxxx>
  • Date: Tue, 05 Oct 2004 10:10:25 -0600
  • Priority: normal

PureBytes Links

Trading Reference Links

> What I am looking for is a way to have this one minute chart, with
> say a 34ema on this based on 13 minute chart. 

In years of using TS4 and TS2ki, I always found multi-data charts 
to be the most frustrating mess in the whole product.  Things 
often didn't work the way you thought they should.  When you had 
to use them they were lifesavers, but if you didn't have to use 
them it was better to avoid them.

Without spending some time digging into exactly what you did, I 
don't know exactly what's going wrong.  But I can show you how to 
do it without multiple data streams.

In your case, assuming the 34-bar EMA is all you need from your 
13min chart, it's fairly easy to do that without a 13-min data2.  
Just calculate the EMA in your EL code using your 1min bars.

For example let's say you were using xaverage(Close of data2, 34) 
like you said.  To calculate that based on your 1min chart, you'd 
do something like this:

(untested, since I don't have my TS here, but should be close)

inputs:  EMAlen(34);
vars: alpha(2/(1+EMAlen)), EMA(Close);

if mod(BarNumber, 13) = 0 then 
  EMA = alpha * Close + (1-alpha) * EMA;

alpha gets initialized to the proper value for an EMAlen-length 
xaverage.  EMA gets initialized to the value of Close on the 
first bar, to give it a reasonable starting value.

Then every 13 bars, you just calculate the new EMA value using 
the close of that 1min bar.

This may not exactly match the EMA on a 13min chart, because it 
may be offset a bit.  E.g. the 13min chart might have bars ending 
at 10:00, 10:13, 10:26, etc, while this code might be 
recalculating on the bars ending at 10:03, 10:16, 10:29, etc.  
But the results should be close enough for your purposes.

Gary