EA or Function to Access OANDA's Margin Requirment Rates

 

I am using OANDA's version of MetaTrader. I am coding an EA that requires real-time access to Oanda's Margin Requirements Rates.These rates are located here: https://www.oanda.com/resources/legal/canada/legal/margin-rates.  How might I access these rates in real-time? Is there a function already built in to MT4 for this? If so, I can't seem to find it. If not, how else might this be achieved? These rates periodically change so hard-coding them is a bad idea. Thanks in advance for the direction.

Long time lurker. First time post. Please be kind.

 

I wouldn't try to use a webpage data as some kind of input variable for EA. (first time i clicked the link, got a 404 error, only to notice it was a IP thing.)
So, since these numbers are not gonna change hourly or so, setting them as Input is safer.

I could try to retrieve and save those numbers by reading a specific place of the loaded webpage (of course through a intermediate sub-program which is not MQL based.)
I ADMIT IT'S A CRAPPY PROCEDURE. but have done similar stuff years ago when I didn't know shit :)

it's crappy, because if any thing on that page is changed, in a manner that changes the layout of the tables, or if the webpage is re-organized,  restyled or even if a single instrument is swapped then my sub-program would read wrong columns and so....


Edit : Using this enum input is pleasing to my mind  :

enum Leverage
{
        None            = 1,
        Two             = 2,
        Three           = 3,
        Five            = 5,
        Ten             = 10,
        Twenty          = 20,
        ThirtyThree     = 33,
        Fifty           = 50,
        Hundred         = 100,
        TwoHundred      = 200,
        FiveHundred     = 500,
        EightHundred    = 800,
        Thousand        = 1000
};
input Leverage USER_SPECIFIED_LEVERAGE_LIMIT = ThirtyThree;
and later in other parts of your code (specifically before sending new orders), you check your calculated lot size, and adjust it (reduce it) if it uses too much leverage
 
Code2219 or probably 2319:

I wouldn't try to use a webpage data as some kind of input variable for EA. (first time i clicked the link, got a 404 error, only to notice it was a IP thing.)
So, since these numbers are not gonna change hourly or so, setting them as Input is safer.

I could try to retrieve and save those numbers by reading a specific place of the loaded webpage (of course through a intermediate sub-program which is not MQL based.)
I ADMIT IT'S A CRAPPY PROCEDURE. but have done similar stuff years ago when I didn't know shit :)

it's crappy, because if any thing on that page is changed, in a manner that changes the layout of the tables, or if the webpage is re-organized,  restyled or even if a single instrument is swapped then my sub-program would read wrong columns and so....


Edit : Using this enum input is pleasing to my mind  :

and later in other parts of your code (specifically before sending new orders), you check your calculated lot size, and adjust it (reduce it) if it uses too much leverage

Thanks for the info. I will explore with enum function and see if it can be used for my application.

Any other approaches I might try? If have a calculation in my code that requires leverage/margin. Leverage/margin may be either the Account Leverage or the Margin Requirement Rate for the specific pair; which ever is greater. The EA allows the user to select ANY pair so I need to take in to account the Margin Requirement Rates for each and every possible pair while at the same time, check to see if that rate should override the Account Leverage.

Reason: