[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: "Michael King" <mrking@xxxxxxxx>
  • Date: Wed, 6 Oct 2004 09:02:49 -0400 (Eastern Daylight Time)

PureBytes Links

Trading Reference Links

 

Get PUSHPOP.DLL then you can push whatever you want from one chart to
anychart you like.

Regards.
 
-------Original Message-------
 
From: Bob Fulks
Date: 10/06/04 08:53:26
To: OmegaList
Subject: Re: Higher timeframe indicator on a lower timeframe chart
 
At 04:45 PM 10/5/2004, Abhijit Dey wrote:
 
>I was actually wondering if there's a generic way to modify indicators (ema

>cci, you name it) to apply higher time frames on smaller time frames like a
>1 minute chart. And I doubt there's a easy way to do so. Sure, I can code
my
>own version of ema and get what I want, but it's not easily portable to any
>other indicator. I have to code all of them one by one. Fortunately, I am
>not using many indicators.
 
At 05:43 PM 10/5/2004, Gary Fritz wrote:
 
>It would be nice if there was a simple way to use existing
>indicator code in this new way, e.g. the way you can use existing
>indicators to refer to other data streams by saying "adx(20) of
>data2" or whatever. But you can't. If you need it, you have to
>rewrite it.
 
There actually is a generic way but it only works if the functions you call
are "simple" (not "series") functions. Simple functions are executed only
when called while series functions are executed on every bar of data1
whether or not they are called on each bar. Here is the idea (untested but
probably close to OK):
 
Var: Dec(5), dBar(FALSE), BarCount(0), dOpen(0),
dHigh(0), dLow(0), dClose(0), Value(0);
 
dBar = FALSE;
 
{ count bars in the day }
if Date <> Date[1]
then BarCount = 1
else BarCount = BarCount + 1;
 
{ find OHLC of decimated bar }
if dBar[1] then begin
dOpen = Open;
dHigh = High;
dLow = Low;
end else begin
if High > dHigh then dHigh = High;
if Low < dLow then dLow = Low;
end;
dClose = Close;
 
{ evaluate the simple function on each decimated bar }
if Mod(BarCount, Dec) = 0 then begin
dBar = TRUE;
Value = <simplefunction>(dOpen, dHigh, dLow, dClose);
end;
 
On 1-minute bars, the simple function would execute on each fifth bar,
corresponding to 5-minute bars.
 
It is usually possible to rewrite functions as simple functions but it tends
to be convoluted since you cannot refer to a past value of a variable as in
"Value1[5]".
 
You can usually do it using arrays to store the past values if you need
them. If you need only one or two past values you can save them as extra
variables as in:
 
L2Value = L1Value;
L1Value = Value;
Value = ....;
Change = Value - L1Value;
 
Hope this helps...
 
Bob Fulks