// ma_cross_optimised
//works really well on 5 min ftse
//variable y, slow ma, 36,201,5
//variable x, fast ma, 2, 35 ,1
REM Buy
indicator1 = Average[x](close)
indicator2 = Average[y](close)
c1 = (indicator1 crosses over indicator2)
IF c1 THEN
BUY 100 shares AT MARKET nextbaropen
ENDIF
REM Sell
indicator3 = Average[x](close)
indicator4 = Average[y](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET nextbaropen
ENDIF
REM Short
indicator5 = Average[x](close)
indicator6 = Average[y](close)
c3 = (indicator5 CROSSES UNDER indicator6)
IF c3 THEN
SELLSHORT 100 shares AT MARKET nextbaropen
ENDIF
REM Exit short
indicator7 = Average[x](close)
indicator8 = Average[y](close)
c4 = (indicator7 CROSSES OVER indicator8)
IF c4 THEN
EXITSHORT AT MARKET nextbaropen
ENDIF