PureBytes Links
Trading Reference Links
|
Martin
and Oscar,
<SPAN
class=044415016-01052003>
Here
is a posting from the Metastockusers Yahoo Group. It is post number 4565
so you can go there to read more of the thread. Here are some working
examples of the plots. Once you understand the code you can adapt them to
your needs. The key here as you will see is to "sample" the shorter
timeframe data for the data you need for the larger
timeframe.
<SPAN
class=044415016-01052003>
Good
Trading,
<SPAN
class=044415016-01052003>
Joe
J.
<SPAN
class=044415016-01052003>
<SPAN
class=044415016-01052003>----------------------------
Roy,
<FONT face=Arial color=#0000ff
size=2>
I just wanted to thank you for your assistance
with
the multiple timeframe matter.
<FONT face=Arial color=#0000ff
size=2>
I was able to take your ideas and make them work.
<FONT face=Arial color=#0000ff
size=2>
Below I'm posting a few indicators I built and
tested
(nice thing is that you can cross check it on
the
hourly charts to see if it is working properly)
for
anyone who might be interested.
<FONT face=Arial color=#0000ff
size=2>
1. Plots hourly closes on a 15 min chart
<FONT face=Arial color=#0000ff
size=2>
{60 minute close plotted on 15 minute bar chart -
note
last half hour is counted as 1 hour - note too
that
time is set for EST}
<FONT face=Arial color=#0000ff
size=2>
H1:=Minute()=30 OR
(Hour()*100+Minute())=1600;
{end of one hour or it is the close of
market}
C1:=ValueWhen(1,H1,C);
{CLOSE for 1 hour bar or market
close}
C1;
<FONT face=Arial color=#0000ff
size=2>
--------------
<FONT face=Arial color=#0000ff
size=2>
2. Plots hourly user inputted EMA on 15 min chart
<FONT face=Arial color=#0000ff
size=2>
{plots 60 minute time based EMA on 15 minute bar
chart
- note last half hour is counted as 1 hour - note
too
that this is set for EST}
<FONT face=Arial color=#0000ff
size=2>
{Hourly Frame EMA}
<FONT face=Arial color=#0000ff
size=2>
Pds:=Input("Hourly
periods",3,99,26);
{ema periods - min, max, default
value}
Pct:=2/(Pds+1);
{percentage calculation to determine how much of
current CLOSE to add
to
previous value of ema, and how much to
discard. This information is
contained
in the
manual}
H1:=Minute()=30 OR
(Hour()*100+Minute())=1600;
{end of one hour or it is the close of
market}
C1:=ValueWhen(1,H1,C);
{CLOSE for 1 hour bar or market
close}
{all same as prevoius formula
above}
Ema:=If(H1,If(PREV=0,CLOSE,(C1*Pct)+(PREV*(1-Pct))),PREV);
<FONT face=Arial color=#0000ff
size=2>
{each hourly bar this var will be updated with
the
appropriate percentage of the hourly CLOSE. - the
very
first time a seeding is used to plot the close only
to
get things started}
<FONT face=Arial color=#0000ff
size=2>
Ema; {output}
<FONT face=Arial color=#0000ff
size=2>
------------
<FONT face=Arial color=#0000ff
size=2>
3. Plots an hourly 12-26-9 MACD Histogram on 15
min
chart.
<FONT face=Arial color=#0000ff
size=2>
{plots 60 minute time based MACD histogram on
15
minute bar chart - note last half hour is counted as
1
hour - note too that this is set up for
EST.
***The MACD histogram is defined as
Fast MACD minus the Slow MACD
line
The fast MACD is the 12 ema minus 26
ema
The slow is a 9 ema of the fast MACD}
<FONT face=Arial color=#0000ff
size=2>
{Hourly Frame MACD Histogram}
<FONT face=Arial color=#0000ff
size=2>
P1:=12;
{first fast ema
period}
PP1:=2/(P1+1);
{converts days to ema
%}
P2:=26;
{second fast ema
period}
PP2:=2/(P2+1);
P3:=9;
{slow ema
period}
PP3:=2/(P3+1);
<FONT face=Arial color=#0000ff
size=2>
H1:=Minute()=30 OR
(Hour()*100+Minute())=1600;
{end of one hour or it is the close of
market}
C1:=ValueWhen(1,H1,C);
{CLOSE for 1 hour bar or market
close}
Ema1:=If(H1,If(PREV=0,CLOSE,
(C1*PP1)+(PREV*(1-PP1))),PREV);
{each hourly bar this var will be updated with
the
appropriate percentage of the hourly CLOSE. - the
very
first time a seeding is used to plot the close only
to
get things started - this first one is for the 12
period ema as defined above}
<FONT face=Arial color=#0000ff
size=2>
Ema2:=If(H1,If(PREV=0,CLOSE,
(C1*PP2)+(PREV*(1-PP2))),PREV);
{same as above but for 26 per ema}
<FONT face=Arial color=#0000ff
size=2>
Ema3:=If(H1,If(PREV=0,(Ema1-Ema2),
((Ema1-Ema2)*PP3)+(PREV*(1-PP3))),PREV);
{same as above but for 9 period ema of the
12
period ema minus the 26 per ema}
<FONT face=Arial color=#0000ff
size=2>
(Ema1-Ema2) - Ema3;
<FONT face=Arial color=#0000ff
size=2>
{output - plot as a histogram}
<FONT face=Tahoma
size=2>-----Original Message-----From: MartinSinclair
[mailto:no_reply@xxxxxxxxxxxxxxx]Sent: Thursday, May 01, 2003 9:24
AMTo: equismetastock@xxxxxxxxxxxxxxxSubject:
[EquisMetaStock Group] Re: Multiple time frameI've
been using multiple time frames for a long time and never was able to
implement it in Metastock. You can't even plot a 60min chart over a 5min
for example. Mixing time series of different time interval is not
possible, even using the "security()" function.In my opinion, the only
way out is to code a user function using the lowest time frame and
simulating the values of the longer period. That seems like a lot of work
and won't even try. Unfortunately this is one thing missing in
Metastock.The most flexible packages regarding that feature are
TradeStation/SuperCharts and NeoTicker. Depending on your data
source,these could not work easily.If someone knows how to do it,
or at least have some ideas about it, I'm willing to help investigate
further.
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|