Guarda come scaricare robot di trading gratuitamente
Ci trovi su Twitter!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Indicatori

Sample pine script stochastic divergence - indicatore per MetaTrader 5

Visualizzazioni:
4292
Valutazioni:
(6)
Pubblicato:
2024.10.20 19:27
Aggiornato:
2025.01.29 14:53
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

The purpose of this code is to convey an idea to people seeking simple and functional approach to converting pine script to MQL5.

Here is the pine script code:

//@version=5

indicator(title='sample stochastic divergence', overlay=true)
stoch_len = input.int(title='stoch_len', defval=5)

f_top_fractal(_src) =>
    _src[4] < _src[2] and _src[3] < _src[2] and _src[2] > _src[1] and 
       _src[2] > _src[0]
f_bot_fractal(_src) =>
    _src[4] > _src[2] and _src[3] > _src[2] and _src[2] < _src[1] and 
       _src[2] < _src[0]
f_fractalize(_src) =>
    f_bot_fractal__1 = f_bot_fractal(_src)
    f_top_fractal(_src) ? 1 : f_bot_fractal__1 ? -1 : 0

stoch = ta.stoch(close, high, low, stoch_len)

fractal_top = f_fractalize(stoch) > 0 ? stoch[2] : na
fractal_bot = f_fractalize(stoch) < 0 ? stoch[2] : na

high_prev = ta.valuewhen(fractal_top, stoch[2], 1)
high_price = ta.valuewhen(fractal_top, high[2], 1)
low_prev = ta.valuewhen(fractal_bot, stoch[2], 1)
low_price = ta.valuewhen(fractal_bot, low[2], 1)

regular_bearish_div = fractal_top and high[2] > high_price and stoch[2] < high_prev
regular_bullish_div = fractal_bot and low[2] < low_price and stoch[2] > low_prev

plot(title='H F', series=fractal_top ? high[2] : na, color=regular_bearish_div ? color.maroon : na, offset=-2)
plot(title='L F', series=fractal_bot ? low[2] : na, color=regular_bullish_div ? color.green : na, offset=-2)
plot(title='H D', series=fractal_top ? high[2] : na, style=plot.style_circles, color=regular_bearish_div ? color.maroon  : na , linewidth=3, offset=-2)
plot(title='L D', series=fractal_bot ? low[2] : na, style=plot.style_circles, color=regular_bullish_div ? color.green : na , linewidth=3, offset=-2)

plotshape(title='+RBD', series=regular_bearish_div ? high[2] : na, text='R', style=shape.labeldown, location=location.absolute, color=color.maroon, textcolor=color.white, offset=-2)
plotshape(title='-RBD', series=regular_bullish_div ? low[2] : na, text='R', style=shape.labelup, location=location.absolute, color=color.green, textcolor=color.white, offset=-2)

Stochastic divergence based on pine script code

Push Notification for Opened / Closed Trades (Netting) Push Notification for Opened / Closed Trades (Netting)

This code provides a simple function for sending push notifications to your mobile device whenever trades are opened or closed in MetaTrader 5. It's designed for netting accounts (where only one position per symbol is allowed).

Script to extract Candlesticks data from all time frames to CSV. Script to extract Candlesticks data from all time frames to CSV.

This MQL5 script exports candlestick data for various timeframes into a CSV file, capturing essential market information like open, high, low, and close prices. It analyzes each candlestick's characteristics, including body and wick sizes, while calculating additional metrics such as candle gaps. After processing the latest 21 bars, it notifies the user upon successful data export.

Economic Calendar CSV Economic Calendar CSV

This script saves a predefined set of economic events from the MetaTrader's built-in economic calendar into CSV file.

Swap Monitor Swap Monitor

This service periodically checks swaps for predefined symbols and saves detected changes into CSV-files for further analysis and potential replay (not implemented here). Also it monitors and alerts swap changes of existing positions.