Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Java Native Interface
 Post subject: Java Native Interface Post rating: 0   New post Posted: Mon 09 Sep, 2013, 17:55 
User avatar

User rating: 0
Joined: Wed 07 Nov, 2012, 16:14
Posts: 28
Hello Support,

I have 2 questions:
1) Can i use the Strategy function in platform to call Jforex api, with an account size less than 100,000 USD?
2) Does the Strategy written in java support c shared library by Java Native Interface?

Thank You!


 
The Best Answer  Post subject: Re: Java Native Interface Post rating: 0   New post Posted: Tue 10 Sep, 2013, 08:03 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
davydai wrote:
1) Can i use the Strategy function in platform to call Jforex api, with an account size less than 100,000 USD?
There are no limitations for JForex API. Any Dukascopy account can use it for free with no limitations.
davydai wrote:
2) Does the Strategy written in java support c shared library by Java Native Interface?
A strategy can do whatever Java SE can do, hence, also use JNI or JNA. For instance (beforehand download the jna.jar file and put it in the respective directory):
@RequiresFullAccess
@Library("c:/temp/jna.jar")
public class StratMsgBoxJna implements IStrategy {

    public interface User32 extends com.sun.jna.Library {
        int MessageBoxA(int hwnd, String text, String caption, int flags);
        public int GetSystemMetrics(int nIndex);
    }

    @Override
    public void onStart(IContext context) throws JFException {
        User32 user32 = (User32) Native.loadLibrary("user32", User32.class);
        user32.MessageBoxA(0, "Hello JForex Strategy", "Test string from JForex Strategy", 1);
        context.getConsole().getOut().println("Screen resolution: " + user32.GetSystemMetrics(1) + " x " + user32.GetSystemMetrics(0));
    }


Attachments:
StratMsgBoxJna.java [1.17 KiB]
Downloaded 119 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com