You were not specific enough in your description for anyone to write the formula. Do you mean that the Cross happens in the EMA of "X", or of "A", or of "B"?
In any event, the functions that you will need are as follows: 1a. Foreign http://www.amibroker.com/guide/afl/afl_view.php? name=foreign or 1b. SetForeign http://www.amibroker.com/guide/afl/afl_view.php? name=setFOREIGN 2. EMA http://www.amibroker.com/guide/afl/afl_view.php?id=44 3. Cross http://www.amibroker.com/guide/afl/afl_view.php?name=cross 4. Ref http://www.amibroker.com/guide/afl/afl_view.php?name=ref 4. How to trade pairs/spreads http://finance.groups.yahoo.com/group/amibroker/message/134492 Mike --- In [email protected], "Alan Nouray" <al...@...> wrote: > > Can anybody help me how to write and test the following formula: > > when 10 day ema crosses the 20 day ema and the close of "X" fund is > higher than the close 50 days ago, then buy fund "A" and sell fund "B" > > when 20 day ema crosses the 10 day ema and the close of "C" fund is > lower than the close 50 days ago, then sell fund "A" and buy fund "B" > > Thank you. > Alan >
