← All projects

cTrader cBots Collection

Three cTrader robots in C#: a candle bot with recovery modules and an MT5 twin, a layered hedge grid for ranging markets, and an EMA retest bot that measures its signal quality.

Client
Forex traders and a trading consultancy
Year
2025
Category
Trading Systems
Stack
  • cTrader
  • cAlgo
  • C#
  • MQL5

The problem

Three forex clients each had a specific idea for a cTrader robot: a candle-based bot with many recovery options, a grid built for ranging markets, and a simple EMA strategy with statistics on how often its signals fail.

What I built

  • Candle bot with recovery modules (cTrader, plus an MQL5 version for MT5):
    • one order per candle with buy/sell offsets, series limits and max consecutive stop-losses
    • ATR gates for opening base orders, suspending the stop and night protection
    • recovery modes after a stop-loss: switch to a lower timeframe, “best profit trade”, consecutive high/low entries, and a take-profit that adapts to equity
    • reversal stop orders placed from a virtual stop-loss
    • equity and balance protectors (percent and dollars), a calendar blackout for holiday weeks and an on-chart recovery panel
  • Layered grid bot for ranging markets:
    • a base grid that runs on its own
    • a hedge layer that starts after N losing grid steps, with a separate volume for each of its 15 levels
    • a recovery layer that resolves the exposed hedge when the market reverses
    • spread guard, max trades per side and positions separated by label
  • EMA retest bot:
    • a 9/21 EMA cross, then entry on a retest of the zone between the EMAs
    • stop a few pips beyond the EMA and a target at 3× the stop, with risk-percent sizing
    • signal-quality statistics: counts consecutive false signals, and reports their average and longest run at stop and on the chart

Details

  • Net top-ups in recovery: the recovery layer adds only the net difference needed to reach its target exposure, not the full multiplied size. All legs close together once the basket reaches breakeven or better.
  • Protection guards: helper checks make sure every position the candle bot opens carries a stop-loss and a take-profit.
  • Two platforms, same bot: the candle bot’s logic was kept aligned between cTrader C# and MQL5.