SL TP Toggle Button MT4
- Indicatori
- Mariusz Franciszek Szczepanczyk
- Versione: 1.0
- Attivazioni: 5
B SL_TS_TP MT4 — SL Toggle for EA One Click B3 MT4
MAIN PURPOSE: Toggle button to ENABLE/DISABLE EA One Click B3 MT4 – blocks automatic SL/TP opening with one click. Industrial‑grade SL button indicator for MT4 build 5430+ with hardcore protection system: auto‑repairs corrupted files, validates positions, cleans old objects, full state synchronization across all charts.
KEY FEATURES:
1. EA One Click B3 MT4 control – Green = EA active (SL/TP ON), Red = EA disabled (no SL/TP).
2. Industrial‑grade reliability – survives platform crashes, corrupted files, restarts.
3. Bulletproof file validation – auto‑detects and repairs invalid .ini positions/states.
4. Multi‑chart synchronization – GlobalVariables + .ini files = consistent state across the platform.
5. Drag & drop positioning – fully movable button with position limits (0–5000 px).
6. Millimeter‑precise sizing – ButtonSize_mm automatically converts to pixels.
7. 4‑corner anchoring – TopLeft(0), TopRight(1), BottomLeft(2), BottomRight(3).
8. Visual state feedback – Green = SL ON (EA active), Red = SL OFF (EA disabled), silver “SL” text.
9. Zero conflicts – auto‑removes old objects by prefix on every init.
10. 1s sync logic – frequent state updates without CPU overload.
11. Works on real and demo accounts.
12. Hedging/netting support – works with all MT4 account types.
Hardcore protection system:
- File validation: checks X/Y bounds (0–5000), repairs invalid positions.
- State recovery: loads from .ini → GlobalVariable → default settings (clear hierarchy).
- Object cleanup: RemoveObjectsByPrefix() removes all old buttons on init.
- Position limits: IsValidPosition() prevents crashes from bad coordinates.
- Drag protection: auto‑resets to defaults if dragged off‑screen.
- Multi‑layer backup: .ini files + GlobalVariables minimize risk of data loss.
Perfect button features:
- Silver “SL” text in Arial font, size derived from ButtonSize_mm (default 4.0) for pixel‑perfect conversion.
- Configurable size in mm (hardware‑independent scaling).
- Drag enabled/disabled via AllowDrag parameter.
- Z‑order 100 – displayed above chart objects but fully interactive.
- Real‑time color changes on click and synchronization with GlobalVariables.
Full synchronization architecture:
- EA_SL_Button_%s.ini – position (X,Y).
- EA_button_state_%s.ini – ON/OFF state.
- EA_Toggle_State_%s – GlobalVariable SL ON/OFF state.
- EA_Toggle_PosX_%s – GlobalVariable X position.
- EA_Toggle_PosY_%s – GlobalVariable Y position.
Perfect deployment:
1. Attach to ANY chart – auto‑generates symbol‑specific files.
2. Button appears at ButtonPosX/ButtonPosY (50,40) in Corner 3 (BottomRight) by default.
3. Drag anywhere OR set X/Y parameters manually.
4. Green = EA One Click B3 MT4 ENABLED (SL/TP active), Red = EA DISABLED (no SL/TP).
5. State/position sync automatically across ALL charts of the same symbol.
6. Survives restarts, crashes and file corruption thanks to layered recovery logic.
Technical superiority:
- MmToPx() – 96 dpi / 25.4 mm = precise pixel conversion.
- ValidateAndRepairFiles() – robust initialization and self‑healing.
- Periodic OnTick/OnTimer sync – frequent updates without overload.
- RemoveObjectsByPrefix() – no old button conflicts.
- Triple state loading: GlobalVariable → .ini → default inputs.
Perfect companion for EA One Click B3 MT4 – toggle SL protection with one click, industrial‑grade reliability, zero maintenance, ready for live trading on ANY broker.
Language – selects the interface language used by the indicator for labels and messages.
EnableIndicator – enables or disables the SL button indicator functionality.
ButtonPosX – sets the horizontal (X) position of the SL button relative to the selected corner.
ButtonPosY – sets the vertical (Y) position of the SL button relative to the selected corner.
Corner (0-3) – selects which chart corner is used as the anchor point for the SL button.
AllowDrag – enables or disables dragging of the SL button on the chart.
ColorOn – sets the background color of the SL button when enabled (ON).
ColorOff – sets the background color of the SL button when disabled (OFF).
ButtonSize_mm – defines the SL button size on the chart in millimeters.
SL_TextColor – sets the color of the "SL" text displayed on the button.
PosFileNameTemplate – template file name used to save button position for each symbol.
StateFileNameTemplate – template file name used to save button state for each symbol.
