create a MT5 indicator that i can manually mark out a box over candles. once the box is fixed and confirmed, alert must be sent once price breaks and closes outside of the high or low of the drawn box. add all seetings for the box , colour , type and all types of settings for the alerts
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is a complete, ready-to-compile MetaTrader 5 indicator that lets you draw a rectangle on the chart with the mouse, confirm it with a hot-key (default: Ctrl + B) and then receive an alert the first time a candle closes outside the rectangle’s upper or lower edge.
All visual and alert parameters are exposed in the Inputs tab so you can change colours, line styles, alert types, etc. without touching the code.
──────────────────────────────
Files you need
──────────────────────────────
DrawBoxBreakAlert.mq5 – the indicator file (copy to …\MQL5\Indicators).
DrawBoxBreakAlert.mqh – optional include (kept in the same folder).
(The code below is self-contained; you can paste everything into one .mq5 file if you prefer.)
──────────────────────────────
How to use
──────────────────────────────
Attach the indicator to any chart.
While the indicator is running, press Ctrl + B (or the hot-key you set) to enter “drawing mode”.
Left-click the chart twice (start and end bar/time) to define the rectangle.
Press Ctrl + B again (or right-click → “Confirm Box”) to lock the rectangle.
From this moment on the indicator watches for the first close outside the box.
When the condition is met you will get the alert(s) you enabled (popup, sound, push, e-mail).
To draw a new box, press Ctrl + B again – the old box is deleted automatically.
──────────────────────────────
Full source code
──────────────────────────────
Save as DrawBoxBreakAlert.mq5
File → New → “Custom Indicator” → Finish (or just open the .mq5 file).
Paste the code above.
Press F7 (Compile).
In the Navigator, drag DrawBoxBreakAlert onto any chart.
──────────────────────────────
Customising
──────────────────────────────
• Change colours, line style, fill, etc. in the Inputs window.
• Change the hot-key: set inpHotKeyCode to any Windows virtual-key code (e.g. 67 for ‘C’).
• To require only the key without Ctrl/Shift, set inpRequireCtrl and inpRequireShift to false.
• Sound file must be placed in …\MetaTrader 5\Sounds\ and listed in terminal settings → Events.
• Push and e-mail require the usual MT5 terminal configuration.
Enjoy your fully configurable box-break indicator!
User
create a tradingview indicator , that allows me to draw a manual box over candles. Once the box is fixed and confirmed. once price trades and closes outside of the box, i must recieve a email notifications. 1 for when price breaks and closes below the bottom of the box and 1 for when price closes above the top of the box
Assistant
Below is a complete, copy-and-paste TradingView indicator (Pine Script v5) that lets you:
Draw a manual rectangle on the chart (with the built-in “Rectangle” drawing tool).
Confirm the rectangle by adding the text “BOX” (case-insensitive) to the rectangle’s description field.
Receive two separate e-mail alerts (one for a close above the top, one for a close below the bottom) the first time each condition occurs after the box is confirmed.
──────────────────────────────
How to use
──────────────────────────────
Save the script below as “Manual Box Break Alert (Email)”.
Add it to your chart.
Draw a rectangle with the Rectangle tool.
Right-click the rectangle → Edit → Description → typeBOX → OK.
(The script now “locks” that rectangle and starts monitoring it.)
Create two e-mail alerts (see instructions below).
When price closes outside the box you will get the corresponding e-mail.