MQL5: TP & SL in Pips
Learn to program Take Profit (TP) and Stop Loss (SL) in pips for MQL5 automated trading robots. This guide covers converting pips to ticks for Forex and Gold, i
Published · Updated · Methodology: Technical Indicators
Part of: Risk Management
- Methodology: Technical Indicators
- Content type: educational
- Markets: Forex, Gold
Source video
Decoded from: Clase 5.1 MQL5: 📏 Cómo Configurar TP & SL en Pips 🎯 Lo Que Nadie Te Explica 📘 by Bot Pulse Trading — watch the original
Key timestamps:
- 0:18 - Introduction to TP/SL in pips
- 1:00 - Measuring TP/SL in pips vs percentage
- 1:30 - Metatrader uses ticks, 10 ticks = 1 pip
- 2:00 - Example: 359 points = 35.9 pips
- 2:50 - Integrating TP/SL into MQL5 bot
- 3:50 - Code explanation: converting pips to ticks for SL
- 5:00 - Handling different decimal places (5 or 3 digits)
- 6:30 - Calculating SL for buy orders (Ask - ticks)
- 7:00 - Calculating TP for buy orders (Ask + ticks)
- 8:20 - Adding calculated SL/TP to order entry
- 8:40 - Calculating SL for sell orders (Bid + ticks)
- 9:20 - Calculating TP for sell orders (Bid - ticks)
- 10:00 - Testing with 10 pips TP and 50 pips SL
- 11:00 - Verification of 10 pips TP (100 ticks) and 50 pips SL (500 ticks)
- 12:00 - Discussion on percentage-based SL/TP for adaptability
Strategy overview
Take profit and stop loss are the two pre-set price levels that close a position automatically — one in profit, one in loss. What this entry covers is not where to place them but what to measure them *in*: it is named after a unit, not a method, which is why the "Technical Indicators" tag carries no timeframe and no named indicator. There is nothing to fill in, because the subject sits a level below methodology — it is the plumbing every setup passes through once it stops being traded by hand and starts being coded.
The source is class 5.1 of Bot Pulse Trading's MQL5 series, in Spanish, and the numbering is meaningful: this is a mid-course fragment that assumes the earlier classes rather than a standalone tutorial. Its six chapter markers over a short runtime make it an indexed reference rather than a walkthrough — the sequence moves from why a stop is stated in pips instead of percentage, to the smaller internal unit the terminal actually counts in, to a worked numeric conversion, and only then to placing the result inside a bot. The channel's framing, "Lo Que Nadie Te Explica", is packaging; the underlying point is narrow and mechanical.
That narrowness is the reason it matters. A trader saying "a 35-pip stop" and an order request expecting the platform's own price units are not speaking the same language, and a misconversion between them raises no error — the bot compiles, runs, and simply risks a different amount than intended, by a clean factor of ten. This page carries the concept and its source, not a decoded setup: no entry or exit rules were extracted, which is the correct outcome for a configuration lesson, since a unit conversion has no triggers to extract in the first place.
Topics
mql5 strategy · pine script · trading strategy · tradingview strategy · forex strategy · gold trading strategy · take profit strategy · stop loss strategy · automated trading · algorithmic trading · coding for traders · technical indicators
Frequently asked questions
What does it mean to set TP and SL in pips?
It means expressing the take-profit and stop-loss distance as a number of pips away from the entry price, rather than as an absolute price level or a percentage of the account. Pips are the unit forex traders speak in, so a stop stated in pips travels between instruments and account sizes more cleanly than a raw price.
Why does an MQL5 bot need pips converted before it can use them?
MetaTrader counts price movement in its own smaller internal unit, not in pips, so a distance a trader states in pips has to be translated before it can be attached to an order. This video's core content is that translation step and where it goes inside the bot.
Is this a trading strategy?
No. It covers a configuration and coding step rather than a setup — it does not define when to enter, when to exit, or what conditions to look for. It is the layer that any strategy relies on once its risk levels have to be written in code instead of dragged on a chart.
Why are there no decoded rules on this page?
Strategy Decoder extracts entry and exit logic from video sources, and a unit-conversion lesson has none to extract. This entry is catalogued for the concept and the source video it comes from; the implementation detail belongs to the original class.
Is the source video in English?
No — it is in Spanish, published by Bot Pulse Trading as part of a numbered MQL5 automation course. The chapter markers make it possible to jump straight to the conversion section without watching the earlier classes, though the series is built to be followed in order.
About this strategy page
This trading strategy was decoded by Strategy Decoder's AI from a public YouTube trading video and turned into a structured, reviewable specification. In the interactive app this page shows the full entry and exit logic, risk management settings, the indicators involved with their parameters, AlgoWizard-compatible logic and a Pine Script export ready for TradingView backtesting — plus an automated backtest verdict when one has been computed for this strategy.
Strategy Decoder catalogs 2,229 decoded strategies. Each one is extracted with confidence scoring, cross-linked to the indicators it uses, and kept up to date as new videos are processed daily. Load this page with JavaScript enabled to use the interactive tools, or start from the strategy explorer to filter by methodology, market and timeframe.
Other versions of this strategy
- F Óptima (Optimal F) Risk Management — Unknown
- Z-Score, Kelly Criterion — Unknown
- Quotex Compounding Strategy — ZORO TRADING TEAM
- Lot Size Calculation — Hobbiecode
- Markowitz Portfolio Theory — PythonIA
- 75 Tick, YM Minidow Futures Trade Management — Orderflows
More decoded strategies
- Dow Jones Strategy Quant X
- Trading Bot Adaptation
- Forex Custom Projects Strategy Quant X
- MQL5 Programming Basics for Expert Advisors
- Strategy Quant Timeframe Modification
- Buy and Sell Signal Indicator
- Nasdaq Custom Project Strategy Quant X
- Fair Value Gap, Liquidity Inflection Levels, Fibonacci Golden Ratio Scalping Strategy