Not logged in
Viewing 6 posts - 1 through 6 (of 6 total)

Forums>StrategyQuant>General Discussion>SQX Reference for compatible function of MT4 Point, Digits and NormalizeDouble

  • #270741 |
    Customer
    37 Posts

    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

    #270766
    Mark Fric
    Administrator
    1182 Posts

    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

    #270775
    Customer
    37 Posts

    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.

    #270776
    Customer
    37 Posts

    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?

     

     

     

    #270777
    Mark Fric
    Administrator
    1182 Posts

    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

    #270778
    Customer
    37 Posts

    Thanks for your prompt support.
    I really appreciate it.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.