Use Foreign or SetForeign/RestorePriceArrays to access data from a symbol other than the current symbol.
http://amibroker.com/guide/afl/afl_view.php?name=foreign e.g. spyMA = MA(Foreign("SPY", "C"), 50); Buy = ... standardSize = ... PositionSize = IIF(spyMA > ..., standardSize, standardSize * 0.5); Mike --- In [email protected], "woodshedder_blogspot" <woodshedder_blogs...@...> wrote: > > I'm sure this has already been covered somewhere, but the search function is > awful and I haven't found anything useful. Feel free to point me to another > thread or the manual if what I'm asking has been covered ad nauseum. > > What I want to do is use index data, say maybe the SPY/SPX, to adjust > position sizes on trades of common stock. > > In Tradestation, one just uses Data 1 (could be the SPY) and Data 2 (the > stock to be traded). > > An easy example of what I want to be able to do is this: > 1. if the SPY is above the 50 dma > 2. and there is an entry signal on a stock > 3. use a full position size > 4. if the SPY is not above the 50 dma, use 1/2 position size > > I'm not asking for any code, just the basic method of using index data to > affect trades. > > Thanks! >
