QF Workshop 2026
Current location: Home > Workshops > QF Workshop 2026

QF Workshop #7: Advanced Programming Trading with TA Tools

Posted:2026-10-29 14:43:17 Click:169

 

QF Workshop #7: Advanced Programming Trading with TA Tools (RSI, MACD, MA, etc.)

Duration: ~1 hour  |  Instructor: Dr. Raymond S. T. Lee

Combine classical technical analysis indicators with MQL5 to design more sophisticated trading systems — a bridge toward Quantum Price Level–based strategies.

1. Common Technical Indicators in MQL5 (10 min)

  • iMA – Moving Averages
  • iRSI – Relative Strength Index
  • iMACD – Moving Average Convergence Divergence
  • iStochastic – Stochastic Oscillator (KDJ)
  • iBands – Bollinger Bands

All return handles; use CopyBuffer() to retrieve values.

2. RSI + Moving Average Strategy Example (18 min)

int rsi_handle, ma_handle;

int OnInit()
{
   rsi_handle = iRSI(_Symbol, PERIOD_H1, 14, PRICE_CLOSE);
   ma_handle  = iMA(_Symbol, PERIOD_H1, 50, 0, MODE_SMA, PRICE_CLOSE);
   return(INIT_SUCCEEDED);
}

void OnTick()
{
   double rsi[], ma[];
   ArraySetAsSeries(rsi, true);
   ArraySetAsSeries(ma, true);
   CopyBuffer(rsi_handle, 0, 0, 1, rsi);
   CopyBuffer(ma_handle, 0, 0, 1, ma);

   double price = SymbolInfoDouble(_Symbol, SYMBOL_BID);

   if(rsi[0] < 30 && price > ma[0] && PositionsTotal()==0)
      trade.Buy(0.1, _Symbol);
   if(rsi[0] > 70 && PositionsTotal()>0)
      trade.PositionClose(_Symbol);
}

3. MACD Crossover with Confirmation (12 min)

int macd_handle = iMACD(_Symbol, PERIOD_H1, 12, 26, 9, PRICE_CLOSE);
double macd_main[], macd_signal[];
ArraySetAsSeries(macd_main, true);
ArraySetAsSeries(macd_signal, true);
CopyBuffer(macd_handle, 0, 0, 2, macd_main);   // Main line
CopyBuffer(macd_handle, 1, 0, 2, macd_signal); // Signal line

if(macd_main[1] < macd_signal[1] && macd_main[0] > macd_signal[0])
   // Bullish crossover
Quantum Upgrade Path: In later workshops, classical indicators will be replaced or augmented by Quantum Price Levels (QPLs) calculated from the Quantum Finance Schrödinger Equation, providing objective, first-principles support and resistance.

Workshop Assignment (6 questions)

  1. Implement an EA that buys when RSI(14) < 30 and MACD main line crosses above the signal line, and sells when RSI > 70 and MACD crosses below. Use H1 timeframe.
  2. Add a filter: only take long trades when price is above the 200-period SMA.
  3. Incorporate Bollinger Bands: buy only when price is near the lower band and RSI is oversold.
  4. Compare the performance of a pure MA crossover EA versus an RSI+MACD EA on the same 6-month EURUSD period. Report win rate and profit factor.
  5. Why might Quantum Price Levels be more objective than classical support/resistance lines drawn from RSI or MACD divergences?
  6. Design a hybrid rule that uses both a classical indicator (e.g., RSI) and a Quantum Price Level for entry confirmation. Describe the logic in words and pseudocode.

QF Workshop #7 – Advanced Trading with TA Tools | Dr. Raymond S. T. Lee

到价提醒[关闭]