Loading…

Inside Bar Breakout EA

This is a published price-action pattern, offered here for study and as a template to adapt, not a guaranteed edge. An inside bar - one whose high sits below the prior bar's high and whose low sits above the prior bar's low - marks a bar that traded entirely within the range of the bar before it, often read as a pause before the range resolves in one direction. The EA does not guess the direction. Once an inside bar closes, it places a buy-stop above that bar's high and a sell-stop below its low, both offset by InpBufferPips so a stop order is never placed exactly on the level. Whichever side price reaches first becomes the trade; the other side is deleted the same tick it is detected as still pending, so a sharp reversal cannot fill both. The stop-loss on each side sits beyond the inside bar's opposite extreme, using the mother bar (the bar the inside bar formed inside) as the wider reference the published technique calls for, plus InpStopLossBufferPips. An unfilled pair is cancelled once the next bar closes - a breakout that has not happened within one bar of the setup forming is no longer this setup's signal, and leaving stale pending orders on the book is how this pattern quietly turns into unrelated risk days later. Notes and limitations - One setup at a time. A new inside bar is only evaluated once no order from the current EA magic number is on the book. - Both the buy-stop and sell-stop share the trade's magic number until one fills; the survivor is deleted immediately after, not on a timer. - Very small inside bars can produce a stop distance narrower than the broker's minimum, in which case the setup is skipped and logged rather than forced through. - Requires AutoTrading enabled (MQL5: TERMINAL_TRADE_ALLOWED, ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT all true); if trading is disabled the EA logs it and does not arm the pair. - A published pattern, not a strategy with a documented statistical edge on any specific symbol - test on your own data before trusting it.

Expert advisor · MT4 · v1.0 · Free

About Inside Bar Breakout EA

Inside Bar Breakout EA is an expert advisor (trading robot) for MetaTrader 4. It places pending buy/sell stop or limit orders, can size trades from your balance and risk percent and trades breakouts. It has 10 settings, such as Buffer pips, Stop loss buffer pips and Reward multiple. MQL source code included.

Files in the download: InsideBarEa.ex4, InsideBarEa.mq4, InsideBarEa.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Buffer pips3Pips added beyond the inside bar's high/low before the stop order
Stop loss buffer pips3Extra pips beyond the inside bar's opposite extreme for the stop-loss
Reward multiple1.5Take-profit as a multiple of the stop distance (0 = no take-profit)
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260817Magic number for orders opened by this EA
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Breakout · Price Action · Candlestick Patterns · Pending Orders · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria