Dukascopy
 
 
Wiki JStore Search Login

Problem going live from demo platforms
 Post subject: Problem going live from demo platforms Post rating: 0   New post Posted: Mon 14 Dec, 2015, 20:44 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi Support

I have recently added a few lines of code to calculate the lot size in my strategy

I then tested the new strategy on the demo platform using the Historic Tester (for a week)
It works perfectly :)

Now , when I try to run the strategy on the live platform I continually get an Out of Memory error (Garbage Collector)

Here is the new code I added:-
private final Locale BASE_LOCALE = Locale.US;
private final Currency BASE_CURRENCY = Currency.getInstance(BASE_LOCALE);
................................
/**
* Calculates the correct lot size according to
* percentage at risk and the currency pair
*
* @param instrument - the instrument in use
* @return
* @throws JFException
*/

private double getLot(Instrument instrument) throws JFException{
double lot;
double equity = myAccount.getEquity();
if(!BASE_CURRENCY.equals(myAccount.getCurrency())){
double bcBid = myHistory.getLastTick(Instrument.fromString(myAccount.getCurrency()+"/"+BASE_CURRENCY)).getBid();
equity *= bcBid;
myConsole.getOut().println("we did get through this !");
}
double latestBid = myHistory.getLastTick(Instrument.fromString(myInstrument.getPrimaryCurrency()+"/"+BASE_CURRENCY)).getBid();
double limit = equity * percentage;
lot = (new BigDecimal(limit/latestBid/(100*10000))).setScale(4, BigDecimal.ROUND_DOWN).doubleValue();
myConsole.getOut().println("Lot Size:- " + lot);
return lot;
}
******************************************************

I am running a PC with Windows 7 Professional

I have tried to increase the java memory by going to the Control Panel -> Programs -> Java -> View-> Runtime Parameters -> -Xms1024m
but when I put any parameter into this blank box, I can NOT load the forex platform ??

Any ideas?

Bob M


 
 Post subject: Re: Problem going live from demo platforms Post rating: 0   New post Posted: Thu 17 Dec, 2015, 18:01 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
You should not usually need to mess with Java memory runtime parameters.

My first guess is you have some sort of recursion going on.... or a memory
leak in Java by holding too many objects in a collection, etc.

HyperScalper


 

Jump to:  

  © 1998-2024 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