[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] parameter dependent on date



PureBytes Links

Trading Reference Links

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 :)
>
> 


Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/