Skip to content

Trade In Each Renko Bar Bot

Version: v.2.0.0.0

Trade In Each Renko Bar Bot

Description

The "Trade In Each Renko Bar Bot" is an algorithmic trading bot designed specifically to execute trades based on the Renko chart's brick formations. Renko charts are unique because they focus on price movement rather than time and volume, creating "bricks" or "bars" when the price moves beyond a specified amount in either direction.

Bullish Trade: When a new green (or upward) brick is fully formed, indicating that the closing price has moved upwards by the pre-defined brick size, the bot will initiate a buy order.

Bearish Trade: Conversely, when a new red (or downward) brick is fully formed, showing that the closing price has moved downwards by the pre-defined brick size, the bot will initiate a sell order.

Properties

General Parameters

  • Backtest Mode [default: false] — Enables or disables backtest mode for the strategy.
  • Debug Mode [default: false] — Enables or disables debug mode for the strategy.
  • Quantity [default: 1, range: 1–∞] — Number of contracts.
  • Stop Loss [default: 1, range: 1–∞] — Stop order setting option.
  • Stop loss Bars Look Back [default: 3, range: 1–∞] — Number of bars to look back for stop loss calculation.
  • Signal Offset (bars) [default: 1, range: 0–∞] — Number of bars to offset entry signals.
  • Bars Since Execution Entry [default: 3, range: 1–∞] — Minimum bars required between entry executions.
  • Volume ratio [default: 1.5, range: 1–∞] — Minimum volume ratio required for trade entry.
  • Use ML.NET filter? [default: true] — Filter signals with ML model.

Ensemble Models

  • Use LightGbm [default: true] — Enable LightGbm classifier.
  • Use FastTree [default: true] — Enable FastTree classifier.
  • Use FastForest [default: true] — Enable FastForest classifier.
  • Use SDCA LogReg [default: true] — Enable SDCA logistic regression.
  • Use LBFGS LogReg [default: true] — Enable LBFGS logistic regression.
  • Use Averaged Perceptron [default: true] — Enable Averaged Perceptron classifier.
  • Use SGD Calibrated [default: true] — Enable SGD calibrated classifier.

Feature Params

  • (Slope) Start Bars Ago [default: 14, range: 1–∞] — Start bar (ago) for VWAP slope.
  • (Slope) End Bars Ago [default: 0, range: 0–∞] — End bar (ago) for VWAP slope.
  • (Delta) Type [default: BidAsk] — Cumulative delta calculation type.
  • (Delta) Period [default: Session] — Cumulative delta period.
  • (Delta) Size Filter [default: 0, range: 0–∞] — Delta size filter (0 = off).
  • (VWAP) Resolution [default: Tick] — VWAP resolution.
  • (VWAP) Standard Deviations [default: Two] — VWAP standard deviation bands.
  • (VWAP) SD1/SD2/SD3 Multiplier [default: 0.75, 1.5, 3, range: 0.001–∞] — VWAP SD multipliers.
  • (ATR) Period [default: 14, range: 1–∞] — ATR period.
  • (MACD) Fast/Slow/Smooth [default: 12, 26, 9, range: 1–∞] — MACD periods.
  • (Gap) Session Start Time [default: 08:30] — Local time of the first bar of the session used for gap calculation.
  • Signal Offset Bars [default: 0, range: 0–∞] — Bars ago to read input signal.

ML Engine

  • Enable Logging [default: false] — When enabled: Print() to Output window and write MLEngine.log.
  • Show Metrics Table [default: true] — Show ensemble metrics table on chart.
  • Show Probability [default: true] — Show probability label on chart.
  • Use Metrics Filter [default: false] — Block signals if metrics below thresholds.
  • Use Auto Weights [default: true] — Auto weight models by AUC and F1.
  • Min Probability [default: 0.5, range: 0–1] — Minimum ensemble probability to pass signal.
  • Bars Ahead [default: 60, range: 1–∞] — Bars ahead used for labeling training samples.
  • Records Before Retrain [default: 10, range: 1–∞] — Minimum samples before retraining.

ML Metrics Filter

  • Min AUC [default: 0.0, range: 0–1] — Minimum AUC required to pass metrics filter.
  • Min F1 [default: 0.0, range: 0–1] — Minimum F1 score required to pass metrics filter.
  • Min Accuracy [default: 0.0, range: 0–1] — Minimum accuracy required to pass metrics filter.
  • Min Precision [default: 0.0, range: 0–1] — Minimum precision required to pass metrics filter.
  • Min Recall [default: 0.0, range: 0–1] — Minimum recall required to pass metrics filter.

Probability Style

  • Probability font — Font family for probability labels.
  • Probability color — Text color for probability labels on chart.
  • Probability offset (ticks) [default: 0, range: -∞–∞] — Vertical offset in ticks.

Table Style

  • Table position [default: TopLeft] — Corner of chart where metrics table is drawn.
  • Table font — Font family for metrics table.
  • Table text color — Text color for metrics table.
  • Table background — Background fill for metrics table.
  • Table outline — Border/outline color for metrics table.
  • Table opacity [default: 75, range: 0–100] — Opacity table (0-100).

Money Management

  • Enable Daily Profit [default: false] — Control daily profit.
  • Enable Daily Loss [default: false] — Control daily loss.
  • Daily loss limit ($) [default: 1000, range: 1–∞] — Daily loss limit in currency.
  • Daily profit target ($) [default: 1000, range: 1–∞] — Daily profit target in currency.

Day of Week

  • Sunday [default: false] — Enable trading on Sunday.
  • Monday [default: true] — Enable trading on Monday.
  • Tuesday [default: true] — Enable trading on Tuesday.
  • Wednesday [default: true] — Enable trading on Wednesday.
  • Thursday [default: true] — Enable trading on Thursday.
  • Friday [default: true] — Enable trading on Friday.
  • Saturday [default: false] — Enable trading on Saturday.

Trading time

  • Enable session 1 times? (optional) [default: false] — Enable first trading session.
  • Session 1 start time [default: 09:30] — Session first start time.
  • Session 1 end time [default: 12:00] — Session first end time.
  • Enable session 2 times? (optional) [default: false] — Enable second trading session.
  • Session 2 start time [default: 09:30] — Session second start time.
  • Session 2 end time [default: 12:00] — Session second end time.
  • Enable session 3 times? (optional) [default: false] — Enable third trading session.
  • Session 3 start time [default: 13:00] — Session third start time.
  • Session 3 end time [default: 14:00] — Session third end time.
  • Enable exit on session close [default: true] — Enable exit at the session close.
  • Session close time [default: 16:50] — Session close time.
  • Exit on session close minutes [default: 1, range: 1–∞] — Minutes before session close to exit.

Note:

If all days are disabled, the strategy will trade without any restrictions on days.

If all trading session clocks are turned off, the auto strategy will trade without time restrictions.

Version Change History

v.1.0.0.5 (Sep 1, 2023)

1) Improved architecture.

2) Added functions to raise position after connection loss.

3) Updated the manual for the bot.

4) Daily profit and drawdown functions can be used in backtest.

v.1.0.0.6 (Sep 29, 2023)

1) Added a debug mode parameter that allows you to output useful code information for the developer.

2) Improved the function of raising the position after connection loss.

v.1.0.0.7 (Nov 12, 2023)

1) Improved trading session time.

2) Improved the function of raising the position after connection loss.

v.1.0.0.8 (Dec 1, 2023)

1) Improved conditions for partial fulfillment of orders.

2) Improved the function of raising the position after connection loss.

3) Added functions for order execution log.

v.1.0.0.9 (Dec 24, 2023)

1) Improved conditions for partial fulfillment of orders.

2) Improved the function of raising the position after connection loss.

v.1.0.1.0 (Mar 14, 2024)

1) Improved conditions for closing a position when the daily loss or profit is reached.

2) Fixed a problem with system variables resetting after the completion of a trade.

3) Changed parameter determining the priority of strategy position or account position.

4) Fixed the problem of strategy transition to the next state while placing an entry order.

5) Fixed an issue with clearing all trade variables after each execution.

v.1.0.1.1 (May 27, 2024)

1) Improved and optimized the function of raising the position after a signal interruption from the data provider.

2) Improved handling of variables to avoid multi-threaded interlocks.

3) Optimized the function of defining stop loss levels and profit target levels.

4) Shortened the display of the auto strategy name on the chart for easier chart viewing.

v.1.0.1.2 (July 22, 2024)

1) Replaced the static class storing trade variables with an instance class, solving the problem of strategy overlap when more than one strategy instance is launched at the same time.

2) Use of order state functions in OnExecutionUpdate methods.

3) Changed order names and name verification during order execution in the OnExecutionUpdate method.

v.1.1.0.0 (May 28, 2025)

1) Added detailed code comments for better understanding.

2) Improved OnBarUpdate method execution conditions.

3) Updated strategy state names for more accurate representation of strategy operation.

4) Added additional volume-based entry conditions.

5) Added session end position closing function.

6) Added descriptive names to exit orders for better understanding of position closure conditions.

7) Add bar offset for entry signal.

8) Sort properties.

v.1.1.0.1 (Oct 26, 2025)

1) Trading hours and days logic updated — if all sessions are disabled, the strategy now runs without time restrictions instead of stopping trading.

v.2.0.0.0 (Mar 9, 2026)

1) ML Engine filter feature added.