Loading…

Risk Reward Box Drawer

A trade plan written as three numbers - entry, stop, target - is easy to misjudge at a glance: a "good" 1:2 ratio can look unremarkable next to a chart, and a genuinely poor one can look fine if the boxes are never actually drawn to scale. This script draws them to scale, one coloured rectangle sized to the entry-to-stop distance and one to the entry-to- target distance, with the pip count, the money amount and the combined reward-to-risk ratio written directly on the chart. Direction is not a dropdown a user could set wrong. It is read from the geometry itself: a stop below the entry with a target above it is a buy, the mirror is a sell, and anything else - both above, both below, equal to the entry - is refused outright with the three prices printed, rather than drawn as a box that means nothing. The money figures are priced using tick value and tick size, never a hardcoded contract size, so a gold, index or JPY-cross plan prices correctly rather than assuming every instrument behaves like a standard forex lot. Because this is a drawing tool and no order is ever sent, there is no live position to read a lot size from - InpLots exists specifically so the money labels are priced for whatever size the plan is actually for. Notes and limitations - This is a drawing aid only - it never places, modifies or closes an order, and does not check margin, stop level or freeze level. - The money figures use the account's current tick value for the symbol. On instruments where tick value floats with the account currency exchange rate, the figure is a snapshot at run time, not a guarantee for when a real order is later placed. - A malformed set of three prices - stop and target on the same side of the entry, or any two prices equal - is refused rather than guessed at. - Boxes are drawn forward from the current bar into empty chart space; they do not track price and are not updated automatically as new bars form. Re-run the script to refresh them.

Script · MT5 · v1.0 · Free

About Risk Reward Box Drawer

Risk Reward Box Drawer is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Entry price, Stop price and Target price. MQL source code included.

Files in the download: RiskRewardBoxDrawer.ex5, RiskRewardBoxDrawer.mq5, RiskRewardBoxDrawer.txt.

Settings

SettingDefaultWhat it does
Entry price0.0Entry price, 0 = current Bid
Stop price0.0Stop price (required)
Target price0.0Target price (required)
Lots0.10Lot size the money labels are priced for
Box width bars20Width of both boxes, in bars
Show ratio labeltrueDraw the reward-to-risk label near the entry
Risk colorC'178,34,34'Risk box colour (entry to stop)
Reward colorC'34,139,34'Reward box colour (entry to target)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria