Played around with 21/34 MA and MACD and this is about the most productive. I post code, please do not ask for explaination, just work it out it is pretty easy. I doubt it is very consistent or reliable over time.
{***************************************
Written by: twalker
Description: Just Fooling: 21/34 MA entry MACD exit
****************************************}
Inputs:length1(21), length2(34), Overbought(0.0006), Oversold(-0.0006);
Variables:T(-1), Aver2(0), Aver1(0), FastMovAvg(9), SlowMovAvg(12), MACDMovAvg(26);
Aver1 = AverageFC(c,length1);
Aver2 = AverageFC(c,Length2);
If CurrentBar > 2
and MACD(Close, FastMovAvg, SlowMovAvg) > overbought
and MACD(Close, FastMovAvg, SlowMovAvg) < MACD(Close, FastMovAvg, SlowMovAvg)[1] Then begin
Exitlong ("MACDlx") This Bar on Close;
T = -1;
end;
If CurrentBar > 2
and MACD(Close, FastMovAvg, SlowMovAvg) < oversold
and MACD(Close, FastMovAvg, SlowMovAvg) > MACD(Close, FastMovAvg, SlowMovAvg)[1] Then begin
ExitShort ("MACDsx") This Bar on Close;
T = 1;
end;
if Aver1 > Aver2 and T > -1 then begin
buy next bar at c stop;
end;
if Aver1 < Aver2 and T < 1 then begin
sell next bar at c stop;
end;