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

[amibroker] Re: MA for a specific stock?



PureBytes Links

Trading Reference Links

>From Amibroker Knowledge Base
Larry

September 29, 2006
How to set individual trading rules for symbols in the same backtest
The following code shows how to use separate trading rules for 
several symbols included in the same backtest. 


// default trading rules if the symbol is not specified below:
Buy = Cross( MA( Close, 20), MA( Close, 50) );
Sell = Cross( MA( Close, 50), MA( Close, 20) );

// individual trading rules for selected symbols 
// that will overwrite the above default rules 
// if particular symbol is detected

// system for MSFT
if( Name() == "MSFT" )
{
 Buy = Cross( MA( Close, 50), MA( Close, 100) );
 Sell = Cross( MA( Close, 100), MA( Close, 50) );
}

// system for IBM
if( Name() == "IBM" )
{
 Buy = Cross( MACD(), Signal() );
 Sell = Cross( Signal(), MACD() );
}

// system for NVDA
if( Name() == "NVDA" )
{
 Buy = Cross( RSI(), 30);
 Sell = 0;
 ApplyStop( stopTypeNBar, stopModeBars, 10);
} 


Note that different per-symbol stops (ApplyStop) are possible only in 
regular (non-rotational) backtest.

 Filed by support at 6:55 am under AFL, Systems



--- In amibroker@xxxxxxxxxxxxxxx, "triangle702000" <jkra70@xxx> wrote:
>
>  I'm wondering if there is a way to assign a moving average only to 
one 
> specific stock and not to every one in the database.For example,if 
I 
> have a 50 day and a 200 day MA applied to all stocks,but I find 
that 
> for "XYZ" a 59 day MA follows the trend a bit better,can I apply a 
59 
> day MA only to XYZ while keeping the 50 and 200 day for the rest?
> 
> I know I can simply add the 59 day,but I'd rather not have it on 
all 
> the other charts if it's possible.Thanks.  -jim
>



------------------------------------

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/