77z3-FX

Dukascopy's Introducing Agent & External Account Manager

jForex order.getComission() not compiling

Bummer, the jForex order.getComission() is not compiling. After some research in Dukascopy support boards (http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=85&t=43119) their response is following:

Of course you cannot compile; these methods are introduced in an api
version far above that what is currently in use in jforex. You can
use them with the standalone api. Or you can calculate the values
yourself.

Thank you very much! Something, that could be easily set from their side, why do each person has to calculate it?!

Not any more!

I just coded a simple commission calculation function based on the commission tables and samples posted on the Dukascopy website: http://www.dukascopy.com/swiss/english/forex/forex_trading_accounts/commission-policy/

 

HERE IS THE CODE: Feel free to use it in your strategy :-)

private double calcComissionUSD(double Deposit, double Equity, double Lots) {
            double amount_array[]={0,5000,10000,25000,50000,250000,500000,1000000,5000000,10000000};
            double com_array[]={48,38,32,25,18,16,14,12,9,5};
            int comD=0,comE=0;
            ///Based on Deposit
            for (int i=0; i<10; i++) {
                if (Deposit>=amount_array[i]) {
                    comD=i;
                }
            }
            ///Based on Equity
            for (int i=0; i<10; i++) {
                if (Equity>=amount_array[i]) {
                    comE=i;
                }
            }
            int minvalue=Math.max(comD,comE);
            return Math.ceil(com_array[minvalue]*Lots*100)/100;
}
Category: >> jForex