- ago
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.
0
600
6 Replies

Reply

Bookmark

Sort
- ago
#1
These are not WealthScript methods. Tried copying them over to your code?
0
Glitch8
 ( 10.41% )
- ago
#2
The equivalent would be accessing the DateTime instance from bars.DateTimes[index]. The DateTime class has members like Day, Month, DayOfWeek, etc.
0
- ago
#3
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.
0
Glitch8
 ( 10.41% )
- ago
#4
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; }
0
- ago
#5
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,
1
- ago
#6
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)
0

Reply

Bookmark

Sort