1. I would like to define a Series for use in a class. My code has trouble with the (this) statement.
2. I would like to use CrossAbove(). However, I think I need a using statement. I just can figure out which one for CrossAbove.
Note: This is sample code to help resolve the issue.
Any thoughts?
JeffCO
public class marketEvent
{[INDENT]Series<double> fastSMA = new Series<double>(this);
Series<double> slowSMA = new Series<double>(this);
int eventType;
public marketEvent ( int initval )
{[/INDENT][INDENT=2]eventType = initval;[/INDENT][INDENT]}
public int checkEvent ( int iFast, int iSlow, int i_CurrentBar, ISeries<double> price )
{[/INDENT][INDENT=2]slowSMS[0] = SMS(iSlow);
fastSMS[0] = SMS(iFast);
if ( CrossAbove( slowSMS, fastSMS, 1 ) )
{[/INDENT][INDENT=3]eventType = 1;[/INDENT][INDENT=2]}
else if ( CrossBelow( slowSMS, fastSMS, 1 ) )
{[/INDENT][INDENT=3]eventType = -1;[/INDENT][INDENT=2]}
else
{[/INDENT][INDENT=3]eventType = 0;[/INDENT][INDENT=2]}[/INDENT][INDENT]}[/INDENT]
}

Comment