Australian (ASX) Stock Market Forum

Amibroker question regarding composites

Joined
18 May 2008
Posts
6
Reactions
0
Hi,

I am using premium data and I want to calculate composites for stocks only. How can I calculate composites applying to a particular group (like all ordinary paid securities) and not to the whole "asx" market group (which includes other things like company options)?

Thanks
 
Run a scan on all stocks using:

Buy=StrLen( Name() ) == 3;
Filter=Buy;

This will give you a list of stocks with only 3 letters in their code. If you have indices (eg. XAO, XJO) etc in a separate watchlist then run the scan excluding the indice list otherwise you'll need to remove them manually.
 
However when I click "calculate composites" in amibroker, it will still calculate based on the market group "asx" which includes everything else. So even when I got the list of 3-letter tickers, how can I apply composite calculating to only those tickers and not the whole market?

Thanks
 
No probs, hth.:)

The Add to composite PDF on the Amibroker support page written by Herman is good reading if you get an opportunity.

Dimitris Tsokakis has also done some interesting work using ATC as well, a search through the Amibroker mailing list archive would turn up some gems. (on second thoughts his atc work may be in the files section?)
 
Trying to work the risk metric so less trade risk and total equity risk is used when drawdown is greater than 5%. I have read the docs. about composites and have assembled this code but it seems a bit ambiguous. Anyone want to run this and see if the results reflect the intention please? It could be the foreign "field" which is not O,H,L,C but rather the percentage of drawdown in stats.GetValue.

Code:
 SetOption("UseCustomBacktestProc", True); 

if( Status("action") == actionPortfolio)
{
  bo = GetBacktesterObject();
 
  bo.PreProcess(); 
 
  MaxDrawdown = Null; 
  
  for(bar=0; bar < BarCount; bar++)
  {
   bo.ProcessTradeSignals(bar);
  
   stats = bo.GetPerformanceStats( 0 ); 

   MaxDrawdown[bar] = stats.GetValue("MaxSystemDrawdownPercent"); 
  }
   bo.PostProcess(); 

  AddToComposite(MaxDrawdown, "~Maximum Drawdown", "X", atcFlagEnableInPortfolio | atcFlagDefaults );

}

MaxDrawdown = Foreign("~Maximum Drawdown", "X"); 

///// Method 1 Percent Risk Higher \\\\\
 
EquityRisk1 = 5; 
TradeRisk1 = 15; 
Method1 = 100 * EquityRisk1/TradeRisk1;

///// Method 2 Percent Risk Lower \\\\\

EquityRisk2 = 2; 
TradeRisk2 = 10; 
Method2 = 100 * EquityRisk2/TradeRisk2;


///// Final Decision \\\\\

SwitchPosSizeMethod = IIf(MaxDrawdown > -5, Method2, Method1);
SetPositionSize(SwitchPosSizeMethod, spsPercentOfEquity);
 
Trying to work the risk metric so less trade risk and total equity risk is used when drawdown is greater than 5%. I have read the docs. about composites and have assembled this code but it seems a bit ambiguous. Anyone want to run this and see if the results reflect the intention please? It could be the foreign "field" which is not O,H,L,C but rather the percentage of drawdown in stats.GetValue.

Code:
 SetOption("UseCustomBacktestProc", True); 

if( Status("action") == actionPortfolio)
{
  bo = GetBacktesterObject();
 
  bo.PreProcess(); 
 
  MaxDrawdown = Null; 
  
  for(bar=0; bar < BarCount; bar++)
  {
   bo.ProcessTradeSignals(bar);
  
   stats = bo.GetPerformanceStats( 0 ); 

   MaxDrawdown[bar] = stats.GetValue("MaxSystemDrawdownPercent"); 
  }
   bo.PostProcess(); 

  AddToComposite(MaxDrawdown, "~Maximum Drawdown", "X", atcFlagEnableInPortfolio | atcFlagDefaults );

}

MaxDrawdown = Foreign("~Maximum Drawdown", "X"); 

///// Method 1 Percent Risk Higher \\\\\
 
EquityRisk1 = 5; 
TradeRisk1 = 15; 
Method1 = 100 * EquityRisk1/TradeRisk1;

///// Method 2 Percent Risk Lower \\\\\

EquityRisk2 = 2; 
TradeRisk2 = 10; 
Method2 = 100 * EquityRisk2/TradeRisk2;


///// Final Decision \\\\\

SwitchPosSizeMethod = IIf(MaxDrawdown > -5, Method2, Method1);
SetPositionSize(SwitchPosSizeMethod, spsPercentOfEquity);


This code is wrong for your purpose. You can not use ATC like that because ATC is created after backtest processed.
You would have to go to a deeper CBI level.
 
Top