Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

JForex client freezes when printing to console rapidly
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=57210
Page 1 of 1

Author:  scotpip [ Sun 01 Dec, 2019, 14:45 ]
Post subject:  JForex client freezes when printing to console rapidly

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.

Author:  mtnfx [ Sun 01 Dec, 2019, 14:58 ]
Post subject:  Re: JForex client freezes when printing to console rapidly

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");
    }

  Page 1 of 1