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.

JForex client freezes when printing to console rapidly
 Post subject: JForex client freezes when printing to console rapidly Post rating: 0   New post Posted: Sun 01 Dec, 2019, 14:45 

User rating: 2
Joined: Thu 07 Nov, 2013, 12:15
Posts: 121
Needed to print out tick values to the console to track down a bug.

When running the historical tester at full speed, it can't cope with the volume of print requests.

The client freezes with very high CPU activity and doesn't recover. Has to be killed from the Task Manager.

I'm running Windows 10 on a high-end HP Workstation with massses of memory and CPU power.


 
 Post subject: Re: JForex client freezes when printing to console rapidly Post rating: 0   New post Posted: Sun 01 Dec, 2019, 14:58 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
I guess you better write that to your custom log file - Jforex's console is not suitable for large number of rows.

You may write to any location on your PC if your strategy/plugin is annotated by @RequiresFullAccess
import com.dukascopy.api.*;
@RequiresFullAccess
public class MyStrategy implements IStrategy {
}

Or you may use write-allowed location like this (exception handling is omitted)
public class MyStrategy implements IStrategy {
    PrintWriter myLog;
   
    @Override
    public void onStart(IContext context) throws JFException {
        File strategyFilesDir = context.getFilesDir();
        File logFile = new File(strategyFilesDir, "my-log.txt");

        context.getConsole().getInfo().println("My log started at: " + logFile);
        myLog = new PrintWriter(logFile);
        myLog.println("something");
    }


 

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