Have a look at SetForeign()/RestorePriceArrays(). Wrap all your trade 
calculation logic within those two calls.

http://www.amibroker.com/guide/afl/afl_view.php?id=247

Mike

--- In [email protected], "graphman27" <st...@...> wrote:
>
> I hear it's possible to generate signals using a proxy (such as an index), 
> but actually buy and sell an ETF, I just can't figure out how to do it within 
> PORTFOLIO.  To you code wizards, how do I change the code below to have the 
> signals come from an index, but yet have the buys and sells acutally be on an 
> ETF?
> 
> Sample Code within a portfolio:
> 
> //symbol-specific rules
> n = Name();
> if( n == "EWZ" )
> {
>     //strategy 1 for Brazil here
> MAShortBuy=Optimize("MAShortBuy",10,7,12,1);
> MALongBuy=Optimize("MALongBuy",50,20,60,10);
> MAShortSell=Optimize("MAShortSell",8,2,8,1);
> MALongSell=Optimize("MALongSell",40,10,40,10);
> 
> Buy =         Cross(MA( Close,MAShortBuy ),MA( Close,MALongBuy ));
> Sell = Cross(MA( Close,MALongSell ),MA( Close,MAshortSell ));
> .............more comes after, but you get the point.......
> 
> This example would have an index titled "BrazilIndex" and have the iShares 
> Brazil ETF (EWZ) for actual purchases.
> 
> Thanks in advance!
> 
> Steve.
>


Reply via email to