That makes total sense.  Let me give that a try.  

Thanks - I'll let you know.  This could be the breakthorugh I've been looking 
for.

Steve.

--- In [email protected], "Mike" <sfclimb...@...> wrote:
>
> I dont' have AmiBroker in front of me right now. But I believe that it is as 
> simple as wrapping your Buy/Sell rules as indicated in my last post:
> 
> ...
> SetForeign("..."); // Replace ... with symbol of your index
> Buy = Cross(MA( Close,MAShortBuy ),MA( Close,MALongBuy ));
> Sell = Cross(MA( Close,MALongSell ),MA( Close,MAshortSell ));
> RestorePriceArrays();
> ...
> 
> SetForeign simply substitutes the price arrays (i.e. O/H/L/C/V/OI) to that of 
> the requested sybmol (e.g. SP-500). All other arrays remain those of the 
> current symbol (e.g. EWZ). Therefore, in the example above, the Buy array is 
> of EWZ but the Close array is of the index (and as a result the calculated MA 
> is of the index).
> 
> Mike
> 
> --- In [email protected], "graphman27" <steve@> wrote:
> >
> > Thanks - I do appreciate your insight.  However, bieng new to Amibroker and 
> > AFL, that is beyond my abilities.  I'm trying to tinker with the concept 
> > right now, but I don't fully understand exactly how to set that up.  It 
> > seems to be pulling trades from a whole host of symbols, so I obviously 
> > didn't do it right.
> > 
> > Any help?
> > 
> > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > >
> > > 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" <steve@> 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