Alım-satım robotlarını ücretsiz olarak nasıl indirebileceğinizi izleyin
Bizi Telegram üzerinde bulun!
Fan sayfamıza katılın
Kodu ilginç mi buldunuz?
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Kodu beğendiniz mi? MetaTrader 5 terminalinde deneyin
Göstergeler

ATR Trailing Stop (Pine Script Port) - MetaTrader 5 için gösterge

Usama Bin Islam
Usama Bin Islam
MQL5 developer: Expert Advisors from written rules, indicator development, Pine Script to MQL5 conversions, and cost-aware backtesting.
How I work:
- I turn your rules into a short written spec (entries, exits, stops, sizing, filters) before writing any code, so we agree on the logic first.
Görüntülemeler:
203
Yayınlandı:
MQL5 Freelance Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git

ATR Trailing Stop (Pine Script port)


A worked example of converting a TradingView Pine Script indicator to MQL5, kept in parity with a Python reference implementation.


Rules (same in all three versions):

- nLoss = ATR multiplier x SMA of true range over InpATRLength bars

- The stop ratchets up under price while price stays above it, and down over price while price stays below it

- The stop flips to the other side, and an arrow is drawn, when price closes through it


Pine to MQL5/Python translation notes (the actual porting work):

- ta.tr(true): the first bar has no previous close, so true range there is just high minus low

- ta.sma(x, n): stays na until n bars exist (first valid value at bar n-1)

- nz(stop[1], src): the previous stop, or the current price while the previous stop is still na

- var float stop = na: state carried from bar to bar, translated to a persistent buffer in MQL5 and a running array in Python

- ta.crossover / ta.crossunder: strictly false while either side is na, which matters for the first valid bar


Repository (Pine source, Python port with a literal bar-by-bar reference implementation for cross-checking, and a parity test comparing both to the MQL5 output): github.com/RAo797bit/pine-python-mql5-conversion


Compiles clean in MetaEditor with 0 errors, 0 warnings ATR trailing stop on a synthetic price series.

EMA Cross Demo EA with ATR Stops EMA Cross Demo EA with ATR Stops

A small demo Expert Advisor: EMA fast/slow cross entries (evaluated on closed bars only, no repainting), ATR-based stop-loss and take-profit, spread filter, and position handling that works on both hedging and netting accounts. Includes a Python reference implementation for parity testing. This is a deliverable example, not a trading recommendation - the attached equity curve is from synthetic data and shows the method, not an edge.

Session TWAP: time weighted average price from the cash open, with deviation bands Session TWAP: time weighted average price from the cash open, with deviation bands

Time weighted average price of the running session, anchored at the cash open of Frankfurt, London, New York or Tokyo with automatic daylight saving. Every second counts the same, minutes without a tick carry the last price, and two bands show the time weighted standard deviation around the line.

Trade Reporter Lite - Telegram trade notifications Trade Reporter Lite - Telegram trade notifications

Posts your MT5 opens and closes to a Telegram chat: side, symbol, entry, stop and target in pips, lots, and on close the result, pips, R-multiple and time held. Retry queue, restart-safe, never trades. Free version of Trade Reporter Telegram and Discord.

CME Gap Tracker for Gold and Bitcoin: Open Gaps, Fill Rate and a Fade-Trade Test CME Gap Tracker for Gold and Bitcoin: Open Gaps, Fill Rate and a Fade-Trade Test

Finds the weekend CME gap on gold and on 24/7 Bitcoin charts, keeps every unfilled gap on the chart until price returns to it, and shows how often gaps filled, how fast, how far price ran first, and what fading them would have made. Non-repainting, with buffers for an Expert Advisor.