Attachments forums

List of attachments posted on this forum.


All files on forums: 136861

MT5 - swap monitor for single currency symbol

JohnnyRy, Tue Feb 06, 2024 3:35 am

Here is a swap monitoring indicator for a single currency pair. The currency symbol input defaults to GBPJPY, but simply replace that with 0 to use the current chart symbol or any other symbol. In this way, the indicator can be attached to a custom chart while drawing data from the base chart symbol. There is a known bug that stalls the swap values at 0.00 if the indicator loads before MT5 loads sufficient data at startup. Removing the indicator and reattaching it is the only workaround I've found, and I've been unable to fix the bug. I've attached source code below, in case another coder can fix it. Otherwise, the indicator updates every minute (M1 bar close) regardless of the chart timeframe to which it is attached. This ensures that the swap values are accurate up to the minute whenever the broker-dealer updates swaps.
 
Note: The swaps in the image are from the generic Metaquotes MT5 demo. Note: The swaps in the image are from the generic Metaquotes MT5 demo.
All files in topic