[font=Arial]I'm trying to reference daily EMA's in a strategy on an intraday chart, which also has the daily data stream for the same symbol as Data2.
I find that if I define any variables based on Data2, the strategy stops generating any trades. This is true even though I don't use those variables for anything or make any other changes in the code.
Can someone point me to what I'm doing wrong?
Here's the relevant code:
// Data1 is a 15-minute chart of a stock, over 2 years.
// Data2 is the daily data stream for the same symbol.
Inputs: // for 3 EMA's
UseEMAFilter(False)
ShortLength( 5),
MidLength(10),
LongLength(17);
// No problem with including these inputs.
Variables: // to check EMA alignment
ShortEMA(0, Data2),
MidEMA(0, Data2),
LongEMA(0, Data2),
Alignup(False),
AlignDn(False);
{If I include the above variable declarations, no trades are generated. If I comment out this Variables section, all the trades (40 or so) reappear.}
{What I want to do is the following. I can't get there because just defining the variables disables the strategy. Any help would be appreciated.
If Date>Date[1] THEN
BEGIN
// UseEMAFilter
IF UseEMAFilter THEN
Begin
// Calculations
ShortEMA = XAverage( Close , ShortLength ) of Data2;
MidEMA = XAverage( Close , MidLength ) of Data2;
LongEMA = XAverage( Close , LongLength ) of Data2;
// Check for alignment; don't comsider it aligned if all 3 are equal.
AlignUp = ShortEMA >= MidEMA AND MidEMA >= LongEMA // Each MA is >= the next slower one
AND (ShortEMA > MidEMA OR MidEMA > LongEMA OR ShortEMA > LongEMA); // Exclude the possibility that all 3 are equal.
AlignDn = ShortEMA <= MidEMA AND MidEMA <= LongEMA // Each MA is <= the next slower one
AND (ShortEMA < MidEMA OR MidEMA < LongEMA OR ShortEMA < LongEMA); // Exclude the possibility that all 3 are equal.
End
I then want to use the variables AlignUp and AlignDn as trade filters.[/font]
Multiple Data Streams in Strategies
Moderator: moderators
-
- rank: <50 posts
- Posts: 1
- Joined: Fri Jun 09, 2006 6:00 pm
- Reputation: 0
- Location: Mount Shasta, CA
- Real name: Russ Allen
- Gender:
Multiple Data Streams in Strategies
Russ Allen
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15560
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3035
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15560
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3035
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.