In WL6 I used GetDay(bar), GetMonth(bar), and GetYear(bar). That does not seem to work with WL7. What are the equivalent for WL7.
Rename
These are not WealthScript methods. Tried copying them over to your code?
The equivalent would be accessing the DateTime instance from bars.DateTimes[index]. The DateTime class has members like Day, Month, DayOfWeek, etc.
Eugene,
In WL6 I used:
public int GetMonth(int bar)
{
return Date[bar].Month;
}
and then
intMonthNow = GetMonth(bar);
But in WL7 I get errors.
In WL6 I used:
public int GetMonth(int bar)
{
return Date[bar].Month;
}
and then
intMonthNow = GetMonth(bar);
But in WL7 I get errors.
That won't work in WL7 because "Date" has no context here. You need to access the "DateTimes" property of the "bars" object.
CODE:
public int GetMonth(BarHistory bars, int bar) { return bars.DateTimes[bar].Month; }
That works, and I just figured out that we don't use "bar" in the execute class. It's "idx".
It took me awhile to figure that out.
Thank you,
It took me awhile to figure that out.
Thank you,
Actually you can even use "bar" in your scripts instead of "idx". Just edit this line:
CODE:
//public override void Execute(BarHistory bars, int idx) public override void Execute(BarHistory bars, int bar)
Your Response
Post
Edit Post
Login is required