aleskresta
You could look up the Datenum() function in the help files for your dates.
Then you use the array based IIF function.
Something like this to get you started:
******
y1 = DateNum() > 1000101 AND DateNum() < 1010101;
y2 = DateNum() > 1010101 AND DateNum() < 1020101;
y3 = DateNum() > 1020101 AND DateNum() < 1030101;
period1 =IIf(y1,1, IIf(y2, 5, IIf(y3,2, Null)));
period2 = IIf(y1,2, IIf(y2, 10, IIf(y3,4,Null)));
Filter = DateNum() > 1000101;
AddColumn( DateNum(),"datenum");
AddColumn(period1, " p1");
AddColumn(period2," p2");
*******
Run the exploration to help you see if the results are as you expected.
Regards
ChrisB
aleskresta wrote:
>
> Hi there,
>
> I need some help please:( I have got, let's say this simple system:
>
> period1 = Optimize( "Perioda 1", 3, 1, 30, 1 );
> period2 = Optimize( "Perioda 2", 5, 1, 120, 2 );
>
> cena = ParamField(" Cena", field = 3 );
>
> Buy = Cross(EMA(cena, period1), EMA(cena, period2)) ;
> Sell = Cross(EMA(cena, period2), EMA(cena, period1)) ;
>
> but now, lets say I want to have the variables to have its value
> dependet on date. Lets say that
>
> for bars between 1.1.2000 and 1.1.2001 it will be
> period1 = 1;
> period2 = 2;
> for bars between 1.1.2001 and 1.1.2002 it will be
> period1 = 5;
> period2 = 10;
> for bars between 1.1.2002 and 1.1.2003 it will be
> period1 = 2;
> period2 = 4;
>
> How can I write it, so I can run AA from 1.1.2000 till 1.1.2003.
> Please help, i read the help file, but did not find any answer:( Tha
> nks a lot :)
>
>