Amibroker Afl Code Link
Buy when the 50-period Moving Average crosses above the 200-period MA. Sell when it crosses below.
// Generate Signals Buy = Cross(MA_Short, MA_Long); Sell = Cross(MA_Long, MA_Short); amibroker afl code
// --- Plot indicators --- Plot(C, "Price", colorBlack, styleCandle); Plot(FastMA, "Fast MA", colorBlue, styleLine); Plot(SlowMA, "Slow MA", colorRed, styleLine); Buy when the 50-period Moving Average crosses above
OOS_Start = ParamDate("OOS Start", "2016-01-01"); InSample = DateNum() < OOS_Start; OptimizeOnly = InSample; // Only optimize in the first period Sell = Cross(MA_Long
// Backtest settings SetPositionSize(1000, spsShares); SetOption("InitialCapital", 100000);