SQX Reference for compatible function of MT4 Point, Digits and NormalizeDouble
5 replies
ytu
2 years ago #270741
Are there compatible functions in SQX Java code library which can replicate the MT4: Point, Digits, and NormalizeDouble?
The best is if you can send me a link of reference URL.
Thanks much
Mark Fric
2 years ago #270766
sure, this is how you get these values in SQ:
Point, Digits
you can use InstrumentInfo.pointValue and InstrumentInfo.decimals
You can get InstrumentInfo from MarketData object, for example:
MarketData.getInstrumentInfo(order.getSymbol()).decimals;
or
Strategy.MarketData.getInstrumentInfo(order.getSymbol()).decimals;
NormalizeDouble
is a standard round to a given number of decimal places.
You can use SQUtils.round(value, digits)
Mark
StrategyQuant architect
ytu
2 years ago #270775
Thanks Mark
I am going to use these function for SQX Custom Indicator, so most likely I am not going to use the ‘order’ object.
How to pass the currency Symbol code into the custom function?
Is it available in ‘ChartData’ type?
Please send me an example of code too.
Thanks for your help, I really appreciate it.
ytu
2 years ago #270776
for example, my custom indicator has these lines:
public class MyMA extends IndicatorBlock {
@Parameter
public ChartData chartInput;
@Parameter(defaultValue=”14″, isPeriod = true, minValue=5, maxValue=200,step=1)
public int Period;
…
…
}
Question: how to pass the correct forex Symbol() to this indicator?
Mark Fric
2 years ago #270777
when you use ChartData chartInput; parameter it is simple:
chartInput.Symbol
If you’d use DataSeries it would be more complicated, but we’ll ad better support for this to the new build.
Mark
StrategyQuant architect
ytu
2 years ago #270778
Thanks for your prompt support.
I really appreciate it.
Viewing 5 replies - 1 through 5 (of 5 total)