I am making a lot of progress on some custom studies and indicators
but
I have run into a road block and am hoping someone here can point
me in the
right direction.
Although the help file states that there are 6 arrays
for each symbol,
isn't there a 7th? That being the date? One array each for
Date,
High, Low, Open, Close, Volume, and OI?
Or is the date a part
of each array as in (Date, High) ... (Date, Close)?
If I can learn how
figure out how to code a simple little indicator it
will allow me to move
forward.
All I would like to do is create an indicator that assigns 4
to a
variable called x if the date of the bar is before the year
2008.
After that date I want the value to be zero.
This is the code
I created:
if (DateNum() < 1080101)
x = 4;
else
x =
0;
From the error message I get it sounds like I have to use a script
to
cycle through each bar.
That means I have to use some looping
code and therefore tried this:
for( i = 1; i < BarCount; i++
)
{
DN = DateNum();
if (DN[i] < 1080101)
x = 4;
else
x =
0;
}
Plot( X, "X", ParamColor("Color", colorBlack ), styleLine
);
All it plots is a zero across all dates.
I have tried a lot
of other combinations as well. Please help as I
have lost enough of my
hairline for one night, lol.
Regards,
MM