I am not a afl-crack for myown but some time ago I wrote a script for 
pairtrading 2 correlated shares. Maybe the script gives you some 
ideas how you can program your strategy in afl:

Ticker1 = "GE";
Ticker2 = "F";

spread = Foreign( Ticker1, "C") / Foreign( Ticker2, "C");
Plot( spread, "spread", colorRed, styleOwnScale);

LongCond=Cross(spread, EMA(spread, 10) );
ShortCond=Cross( EMA(spread, 10), spread );

if (Name()== Ticker1)
{
Buy=LongCond;
Sell=ShortCond;
Short=Sell; Cover=Buy;

}
else if (Name()==Ticker2)
{
Buy=ShortCond;
Sell=LongCond;
Short=Sell; Cover=Buy;

}

PositionSize = -25;

Regards
mmike

--- In [email protected], "drzingaro" <[EMAIL PROTECTED]> wrote:
>
> hi,
> 
> some scrips within the same sector show strong corelation in their
> market price over a long period. Their ratio exhibits the 
corelation.
> 1. I need to explore / search for such scrips from a sector
> 2.plot closing prices of 2 such securities on same chart
> 3.plot their price ratio (price of scrip 1 / price of scrip 2)in a
> different pane.
> 4. plot say 60days mean of this ratio on the ratio chart.
> 5.plot bolinger bands for this mean on the same chart.
> 
> strategy - The scrips exhibit a strong correlation and
> have a tendency to revert to the mean and move in a trading band. 
> when price ratio shifts to the upper or lower boundry of the trading
> range. Traders
> may initiate a neutral strategy and go long on scrip A and go short 
on
> Scrip B.
> 
> reverse / square the trade when the ratio shifts to the mean.
> 
> can anyone help me on afl?
> 
> regards
> 
> dr zingaro
>


Reply via email to