Contents tagged with java

  • How to read little endian file of floats in Java

    Hello everybody,

    today I want to document another issue that took from me plenty of time. Recently I've used following code in Python in order to save array of numpy numbers:

    import numpy as np

    newImage = ...some way of getting array

    np.ndarray.tofile(newImage, newFn)

    But when I tried to get that content in Java code, I faced issue that my inputs where unreadable by Java. After spending some time over net I've found that Python uses little endian encoding, while Java uses another encoding for saving floats. 

    So my research of little endian gave me the following code result in java for reading little endian:

    InputStream inputStream = null;DataInputStream dataInputStream = null; … more

  • jForex non standard time frame ema value

    Hello everybody,

    Few days ago I had an order for automating forex strategy for 3 minutes time frame in jForex platform.

    I faced issue that by default jForex doesn't work with 3 minutes. In order to do this, the following parts were needed for addition:


    public void onStart(IContext context) throws JFException {

    period3Min = Period.createCustomPeriod(Unit.Minute, 3);

    edDescriptor myFeed = new TimePeriodAggregationFeedDescriptor(Instrument.EURUSD, period3Min, OfferSide.ASK);

    ontext.subscribeToFeed(myFeed, new IFeedListener() {@Override

    pan style="color: #008800; font-weight: bold;">public void onFeedData(IFeedDescriptor feedDescriptor, ITimedData feedData) {

    try {

    nsole. … more