This class very helpful if you need to calculate conversion coefficient from one currency to another. It does not connect to MT4 server, all calculations happen locally.
PriceHelper
class lays under CPlugin.PlatformWrapper.MetaTrader4.Utilities
namespace.
Get conversion coefficient #
For example, you need to know, what value would be if you need to convert from GBP to XAU?
// instantiate variable of class PriceHelper
var ph = new PriceHelper();
// write there all needed prices
ph.UpdatePrices("GBPUSD", 1.60, 1.61);
ph.UpdatePrices("XAUUSD", 1300, 1301);
// etc
// get coefficient
var pc = pc.GetPriceCoeffInCurrency("GBP", "XAU");
Get price of single pip #
To get price of one pip you can use function GetPriceOnePipsInCurrency
.
For example:
// instantiate variable of class PriceHelper
var ph = new PriceHelper();
// write there all needed prices
ph.UpdatePrices("GBPUSD", 1.60, 1.61);
// etc
// get pip price in USD when you trade GBPUSD
var pop = pc.GetPriceOnePipsInCurrency("GBPUSD", "USD");