거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
지표

Sample pine script stochastic divergence - MetaTrader 5용 지표

조회수:
4711
평가:
(6)
게시됨:
2024.10.20 19:27
업데이트됨:
2025.01.29 14:53
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

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.