StrToNum returns a scaler. If you want your variables to hold arrays,
then you need to construct them as such.
e.g.
MinSlope = EntryThreshold = ExitThreshold = ATRmult = MOP = PercentRisk
= 0;
aYear = Year();

for ( i = 1999; i <= 2010; i++ )
{
     sYear = VarGetText( "s" + i );
     MinSlope = IIf( i == aYear, StrToNum( StrExtract( sYear, 0 ) ),
MinSlope );
     EntryThreshold = IIf( i == aYear, StrToNum( StrExtract( sYear, 1 )
), EntryThreshold );
     ExitThreshold = IIf( i == aYear, StrToNum( StrExtract( sYear, 2 ) ),
ExitThreshold );
     ATRmult = IIf( i == aYear, StrToNum( StrExtract( sYear, 3 ) ),
ATRmult );
     MOP = IIf( i == aYear, StrToNum( StrExtract( sYear, 4 ) ), MOP );
     PercentRisk = IIf( i == aYear, StrToNum( StrExtract( sYear, 5 ) ),
PercentRisk );
}

Plot( MinSlope, "Slope", colorBlue );
Plot( EntryThreshold, "Entry", colorGreen );
Plot( ExitThreshold, "Exit", colorRed );
Plot( ATRmult, "ATR", colorYellow );
Plot( MOP, "MOP", colorOrange );

Mike
--- In [email protected], "bh.hicks" <bh.hi...@...> wrote:
>
> I am trying to switch variable sets by date (see code below) during a
backtest.  The problem is the backtester seems to only be using the
variables from the last date set in the AA From/TO box.  I'm pretty sure
I've got the logic right but I am having difficulty with the syntax of
how to do this.  Anyone got any ideas?
>
> Basically, the goal is to run a OOS walk-forward tests using
pre-calculated IS variables as a continuous sequence that does not exit
positions at date transitions and would more closely mirror how a system
was traded in real-time.
>
>
> ////////////////////  VARIABLES  ////////////////////
> s1999 = "1500,10,99,2,3,3";
> s2000 = "1500,10,99,2,3,3";
> s2001 = "100,10,50,2,3,3";
> s2002 = "1500,10,99,2,3,3";
> s2003 = "1500,10,99,2,3,3";
> s2004 = "1500,10,99,2,3,3";
> s2005 = "1500,10,99,2,3,3";
> s2006 = "1500,10,99,2,3,3";
> s2007 = "1500,10,99,2,3,3";
> s2009 = "1500,10,99,2,3,3";
> s2010 = "20,10,50,2,3,3";
>
> ////////////////////  DATERANGE  ////////////////////
> sYear = VarGetText("s"+Year());
>
> MinSlope = StrToNum(StrExtract(sYear,0));
> EntryThreshold =  StrToNum(StrExtract(sYear,1));
> ExitThreshold =  StrToNum(StrExtract(sYear,2));
> ATRmult =  StrToNum(StrExtract(sYear,3));
> MOP =  StrToNum(StrExtract(sYear,4));
> PercentRisk =  StrToNum(StrExtract(sYear,5));
>

Reply via email to