### Get Started Strategies Map (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/IClient Retrieves a map of all strategies currently started by the process, where keys are strategy IDs and values are the strategy objects. ```java java.util.Map getStartedStrategies() ``` -------------------------------- ### Get Started Strategies Map (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Returns a map containing currently started strategies, keyed by their IDs. ```java java.util.Map IClient.getStartedStrategies() ``` -------------------------------- ### Start Strategy Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterClient Starts a trading strategy with specified parameters for progress monitoring, visual mode, execution control, UI interaction, and data writing. ```APIDOC ## startStrategy ### Description Starts the strategy. If no GUI mode is used, then all of testerVisualModeParameters, testerExecution and testerUserInterface parameters should be null. ### Method Starts a trading strategy. ### Endpoint N/A (Java method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strategy** (IStrategy) - Required - The strategy object to run. - **testerProgressListener** (LoadingProgressListener) - Optional - Provides progress information and allows cancellation. - **testerParametersForVisualMode** (ITesterParametersForVisualMode) - Optional - Visual mode optional parameters. - **testerExecution** (ITesterExecution) - Optional - Allows control of strategy execution (stop, continue, cancel). - **testerUserInterface** (ITesterUserInterface) - Optional - Provides access to various strategy testing GUI parts. - **writeHTDataToFiles** (boolean) - Optional - If false, history loading and indicator calculation with big look back will be based on real data from real cache instead of interpolated data. ### Request Example ```json { "strategy": "myStrategyObject", "testerProgressListener": "myProgressListenerObject", "testerParametersForVisualMode": null, "testerExecution": "myExecutionObject", "testerUserInterface": "myUIObject", "writeHTDataToFiles": true } ``` ### Response #### Success Response (200) - **processId** (long) - The process ID assigned to the strategy. #### Response Example ```json { "processId": 1234567890 } ``` ### Errors - **java.lang.IllegalStateException**: if not connected. - **java.lang.IllegalArgumentException**: if one of the parameters is null. ``` -------------------------------- ### Get Start Time Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/ITimeDomain The getStart() method within the ITimeDomain interface returns the starting timestamp as a long integer. This method is abstract and must be implemented by any class that implements ITimeDomain. ```java long getStart() ``` -------------------------------- ### Start Strategy (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/IClient Starts a trading strategy. One method uses a default exception handler, while the other allows a custom exception handler to be provided. Both methods require a connected client and valid strategy object. ```java long startStrategy(IStrategy strategy) throws java.lang.IllegalStateException, java.lang.NullPointerException ``` ```java long startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler) throws java.lang.IllegalStateException, java.lang.NullPointerException ``` -------------------------------- ### Starting Strategy with IStrategyListener (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategyListener Demonstrates deprecated methods for starting a strategy using an IStrategyListener. These methods are part of the IStrategies interface and accept parameters like a file, listener, configuration map, and access level, or a strategy object, listener, and access level. It's recommended to use IClient.startStrategy(IStrategy) instead. ```java long startStrategy(java.io.File jfxFile, IStrategyListener listener, java.util.Map configurables, boolean fullAccess) long startStrategy(IStrategy strategy, IStrategyListener listener, boolean fullAccess) ``` -------------------------------- ### Start Strategy in Tester Client with Full Tester Parameters (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client with comprehensive parameters including progress listener, execution details, and user interface. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` -------------------------------- ### Start Strategy with ITesterVisualModeParameters (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/tester/class-use/ITesterVisualModeParameters Demonstrates how to start a trading strategy using the ITesterClient interface, with specific methods showing the inclusion of ITesterVisualModeParameters. These methods are used for initiating strategy execution within the Dukascopy testing environment. ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` -------------------------------- ### Start Strategy in Tester Client with Visual Mode Parameters (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client with visual mode parameters, execution details, and user interface. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` -------------------------------- ### Start Strategy in Tester Client with Progress Listener (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client, providing a loading progress listener. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener) ``` -------------------------------- ### Start Plugin with GUI Listener (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/IClient Starts a plugin and provides a listener for GUI events. It returns a unique identifier for the plugin. Exceptions can be thrown if the client is not connected or if input parameters are null. ```java java.util.UUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler, PluginGuiListener pluginGuiListener) ``` -------------------------------- ### Start Strategy with Visual Mode Parameters Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterClient Starts a strategy with specific parameters for visual mode testing, including optional parameters for visual mode, execution control, and user interface access. This method is intended for visual testing scenarios and returns a process ID. It can throw exceptions if prerequisites are not met. ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException ``` -------------------------------- ### Get Started Strategies in Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/strategy/IStrategyManager Illustrates how to retrieve a list of all currently running remote strategies. This method returns a Future object that resolves to an IStrategyResponse containing a set of strategy descriptors. Error handling for the retrieval process is included. ```java //Retrieve remote strategies from a remote strategy manager, to retrieve local strategies use ILocalStrategyManager IStrategyResponse > listResponse = strategyManager.getStartedStrategies().get(); if (listResponse.isError()) { System.err.println("Failed to retrieve remote strategy list"); } else { Set strategyDescriptors = listResponse.getResult(); System.out.println("Remotely started " + strategyDescriptors.size() + " strategies: "); for (IStrategyDescriptor strategyDescriptor : strategyDescriptors) { System.out.println(strategyDescriptor.toString()); } } ``` -------------------------------- ### Start Strategy with Default Parameters in Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/strategy/remote/IRemoteStrategyManager Demonstrates how to start a trading strategy using default parameters. It shows how to initiate the strategy and subsequently retrieve its response, checking for errors and obtaining the strategy ID if successful. This method requires a File object representing the strategy JFX file. ```java java.util.concurrent.Future> startStrategy(java.io.File strategyFile, boolean stopOnError) throws java.io.IOException // start a strategy without fetching the id strategyManager.startStrategy(jfxFile); // start and fetch the id IStrategyResponse startResponse = strategyManager.startStrategy(jfxFile).get(); if (startResponse.isError()) { System.err.println("Strategy failed to start: " + startResponse.getErrorMessage()); } else { myStrategyId = startResponse.getResult(); System.out.println("Strategy successfully started: " + myStrategyId); } ``` -------------------------------- ### ITesterClient - startStrategy (Basic) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/LoadingProgressListener Starts the strategy execution with a loading progress listener. ```APIDOC ## POST /websites/dukascopy_client_javadoc3/ITesterClient/startStrategy ### Description Starts the strategy execution with a loading progress listener. ### Method POST ### Endpoint /websites/dukascopy_client_javadoc3/ITesterClient/startStrategy ### Parameters #### Request Body - **strategy** (IStrategy) - Required - The strategy to start. - **testerProgressListener** (LoadingProgressListener) - Required - Listener for progress updates during strategy execution. ### Request Example ```json { "strategy": "com.dukascopy.api.IStrategy", "testerProgressListener": "com.dukascopy.api.system.LoadingProgressListener" } ``` ### Response #### Success Response (200) - **long** - The unique identifier for the started strategy. #### Response Example ```json { "strategyId": 12345 } ``` ``` -------------------------------- ### Start Strategy in Tester Client with Visual Mode and HT Data Writing (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client, enabling visual mode, HT data writing to files, and other essential parameters. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` -------------------------------- ### Start Strategy with LoadingProgressListener (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/LoadingProgressListener Starts a strategy within the tester client. This method has several overloads that accept a LoadingProgressListener to monitor the strategy's startup progress and other optional parameters for execution and UI. ```java long ITesterClient.startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler, LoadingProgressListener testerProgressListener) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` -------------------------------- ### Start Strategy in Tester Client with Exception Handler (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy within the tester client, including an exception handler and a loading progress listener. ```java long ITesterClient.startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler, LoadingProgressListener testerProgressListener) ``` -------------------------------- ### Start Strategy in Tester Client with Visual Mode Parameters, HT Data Writing, and Progress (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client, configuring visual mode, HT data file writing, and progress tracking. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` -------------------------------- ### Get Previous Bar Start Time Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/JFException Returns the starting time of the bar previous to the bar that includes the specified time. ```APIDOC ## GET /api/history/previous-bar-start ### Description Returns the starting time of the bar previous to the bar that includes the specified time. ### Method GET ### Endpoint `/api/history/previous-bar-start` ### Parameters #### Query Parameters - **period** (Period) - Required - The period of the bars (e.g., DAILY, HOUR). - **barTime** (long) - Required - The timestamp within the bar. ### Request Example ```json { "period": "DAILY", "barTime": 1678972800000 } ``` ### Response #### Success Response (200) - **startTime** (long) - The starting timestamp of the previous bar. #### Response Example ```json { "startTime": 1678886400000 } ``` ``` -------------------------------- ### Initialize Strategy with Context Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IStrategy The onStart method is called once when the strategy begins execution. It's used for initializing strategy variables, subscribing to instruments and data feeds, and performing other setup operations using the provided IContext. ```java void onStart(IContext context) throws JFException { context.setSubscribedInstruments(new HashSet(Arrays.asList(Instrument.EURUSD, Instrument.AUDCAD), true)); } ``` -------------------------------- ### Start Strategy with IStrategy Listener (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy This method is used to start a strategy with a listener and full access. It is deprecated and a newer version is recommended. ```java long IStrategies.startStrategy(IStrategy strategy, IStrategyListener listener, boolean fullAccess) ``` -------------------------------- ### onStart Method Implementation Example (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IJFRunnable Illustrates the `onStart` method of the IJFRunnable interface. This method is called when a strategy begins execution and receives the execution context. ```Java /** * Called when the strategy starts. * @param t The execution context. * @throws JFException If an error occurs during strategy startup. */ void onStart(T t) throws JFException; ``` -------------------------------- ### Java: Start Plugin with GUI Listener and Exception Handler Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/class-use/IStrategyExceptionHandler This Java code snippet illustrates starting a strategy using the IClient interface, which includes an IStrategyExceptionHandler for error management and a PluginGuiListener for GUI interactions. Dependencies include the Plugin class, IStrategyExceptionHandler, and PluginGuiListener. ```java IClient.runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler, PluginGuiListener pluginGuiListener) ``` -------------------------------- ### RegressionChannel Initialization Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/RegressionChannel The onStart method is called once during indicator initialization. It receives an IIndicatorContext object, which provides access to system functionalities for setup. ```java public void onStart(IIndicatorContext context) ``` -------------------------------- ### Get Strategy Start Time - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterReportData Retrieves the time in milliseconds when the strategy started its execution. Returns a long value. ```java long getFrom() ``` -------------------------------- ### IRemoteStrategyManager - Start Strategy (With Parameters) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/strategy/remote/IRemoteStrategyManager This endpoint allows starting a strategy with custom parameters. The number and types of parameters must match the strategy's configurable fields. It returns a Future object for server response retrieval. ```APIDOC ## POST /startStrategy ### Description Starts a strategy with specified parameters. ### Method POST ### Endpoint /startStrategy ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strategyFile** (File) - Required - The JFX file of the strategy to run. - **params** (Object[]) - Required - An array of strategy parameters. The size and types must match the strategy's public `Configurable` fields. - **stopOnError** (boolean) - Required - A flag to indicate whether the strategy should stop upon encountering an error. ### Request Example ```json { "strategyFile": "/path/to/strategy.jfx", "params": ["param value", 1, "another param value"], "stopOnError": false } ``` ### Response #### Success Response (200) - **Future>** - An object representing the asynchronous result of the strategy start operation. This Future can be used to retrieve the `IStrategyResponse` which contains the strategy ID or error information. #### Response Example ```json { "result": "f0e9d8c7-b6a5-4321-fedc-ba9876543210", "isError": false, "errorMessage": null } ``` ### Throws - `java.io.IOException` - In case of strategy file read/load error. - `JFException` - In case of parameter error (e.g., incorrect array size or wrong value type). ``` -------------------------------- ### Get Current Bar Start Time Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/JFException Returns the starting time of the current bar (the bar currently being generated from ticks) for a specified instrument and period. ```APIDOC ## GET /api/history/current-bar-start ### Description Returns the starting time of the current bar (the bar currently being generated from ticks) for a specified instrument and period. ### Method GET ### Endpoint `/api/history/current-bar-start` ### Parameters #### Query Parameters - **instrument** (Instrument) - Required - The financial instrument. - **period** (Period) - Required - The period of the bars (e.g., DAILY, HOUR). ### Request Example ```json { "instrument": "EUR/USD", "period": "HOUR" } ``` ### Response #### Success Response (200) - **startTime** (long) - The starting timestamp of the current bar. #### Response Example ```json { "startTime": 1678972800000 } ``` ``` -------------------------------- ### PPOscillator Initialization and Parameter Setting Methods - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/PPOscillator Includes methods for initializing the PPOscillator indicator (`onStart`) and for setting its input, optional input, and output parameters. ```java public void onStart(IIndicatorContext context) { // Implementation details for indicator initialization } public void setInputParameter(int index, java.lang.Object array) { // Implementation details for setting input parameter } public void setOptInputParameter(int index, java.lang.Object value) { // Implementation details for setting optional input parameter } public void setOutputParameter(int index, java.lang.Object array) { // Implementation details for setting output parameter } ``` -------------------------------- ### Get Formula Values Stream From (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/indicators/IFormulaTimeData Retrieves a stream of formula values from a specified starting point in the timed data. It takes a starting ITimedData object, a boolean indicating inclusivity of the start bar, and an output index. This method is useful for analyzing data segments starting from a particular point. ```java java.util.stream.Stream getFormulaValuesStreamFrom(ITimedData fromBar, boolean fromInclusive, int outputIndex) ``` -------------------------------- ### Start Strategy (Dukascopy API) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterClient Initiates the execution of a trading strategy within the Dukascopy testing environment. This method can accept various parameters to configure the testing process, including progress listeners, visual mode parameters, execution interfaces, user interfaces, and options for writing historical data to files. It returns a long identifier for the started strategy. ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterParametersForVisualMode testerParametersForVisualMode, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface, boolean writeHTDataToFiles) ``` ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException ``` -------------------------------- ### Java: Start Plugin with Exception Handler Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/class-use/IStrategyExceptionHandler This Java code snippet demonstrates how to start a plugin using the IClient interface, providing an IStrategyExceptionHandler to manage any exceptions that occur during the plugin's execution. It requires the Plugin class and the IStrategyExceptionHandler interface. ```java IClient.runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler) ``` -------------------------------- ### Start Strategy in Tester Client with Visual Mode Parameters and HT Data Writing (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategy Starts a strategy in the tester client with visual mode parameters, allowing for HT data to be written to files. ```java long ITesterClient.startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) ``` -------------------------------- ### Java: Start Strategy in Tester with Progress Listener and Exception Handler Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/class-use/IStrategyExceptionHandler This Java code snippet demonstrates starting a strategy within the testing environment using ITesterClient. It includes an IStrategyExceptionHandler for exception management and a LoadingProgressListener to track the loading progress of the strategy. ```java ITesterClient.startStrategy(IStrategy strategy, IStrategyExceptionHandler exceptionHandler, LoadingProgressListener testerProgressListener) ``` -------------------------------- ### BollingerBandwidth: onStart Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/BollingerBandwidth Initializes the indicator by setting up the context. This method is called once when the indicator is loaded. ```java public void onStart(IIndicatorContext context) Description copied from interface: IIndicator Called on indicator initialization Specified by: onStart in interface IIndicator Parameters: context - allows access to system functionality ``` -------------------------------- ### Get Subscription Period Start Date - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/NewsFilter Retrieves the start date of the subscription's period. This method is part of the INewsFilter interface and returns a java.util.Date object. ```java public final java.util.Date getFrom() ``` -------------------------------- ### IRemoteStrategyManager - Start Strategy (Default Parameters) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/strategy/remote/IRemoteStrategyManager This endpoint allows starting a strategy using default parameters. It returns a Future object that can be used to obtain the server's response. ```APIDOC ## POST /startStrategy ### Description Starts a strategy with default parameters. ### Method POST ### Endpoint /startStrategy ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strategyFile** (File) - Required - The JFX file of the strategy to run. - **stopOnError** (boolean) - Required - A flag to indicate whether the strategy should stop upon encountering an error. ### Request Example ```json { "strategyFile": "/path/to/strategy.jfx", "stopOnError": true } ``` ### Response #### Success Response (200) - **Future>** - An object representing the asynchronous result of the strategy start operation. This Future can be used to retrieve the `IStrategyResponse` which contains the strategy ID or error information. #### Response Example ```json { "result": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "isError": false, "errorMessage": null } ``` ### Throws - `java.io.IOException` - In case of strategy file read/load error. ``` -------------------------------- ### IHistory - Current Bar Time Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/Period Methods to get the start time of the currently forming bar. ```APIDOC ## GET /IHistory/getStartTimeOfCurrentBar ### Description Returns the starting time of the current bar (the bar currently being generated from ticks) for the specified instrument and period. This method is deprecated in favor of the overloaded version. ### Method GET ### Endpoint `/IHistory/getStartTimeOfCurrentBar` ### Parameters #### Query Parameters - **instrument** (Instrument) - Required - The financial instrument. - **period** (Period) - Required - The period of the bars. ### Response #### Success Response (200) - **startTime** (long) - The starting timestamp of the current bar. #### Response Example ```json { "startTime": 1678890000000 } ``` ``` -------------------------------- ### ITesterClient - startStrategy (With UI and Execution) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/LoadingProgressListener Starts the strategy execution with UI, execution components, and a loading progress listener. ```APIDOC ## POST /websites/dukascopy_client_javadoc3/ITesterClient/startStrategy ### Description Starts the strategy execution with UI, execution components, and a loading progress listener. ### Method POST ### Endpoint /websites/dukascopy_client_javadoc3/ITesterClient/startStrategy ### Parameters #### Request Body - **strategy** (IStrategy) - Required - The strategy to start. - **testerProgressListener** (LoadingProgressListener) - Required - Listener for progress updates during strategy execution. - **testerExecution** (ITesterExecution) - Required - Execution component for the strategy. - **testerUserInterface** (ITesterUserInterface) - Required - User interface component for the strategy. ### Request Example ```json { "strategy": "com.dukascopy.api.IStrategy", "testerProgressListener": "com.dukascopy.api.system.LoadingProgressListener", "testerExecution": "com.dukascopy.api.ITesterExecution", "testerUserInterface": "com.dukascopy.api.ITesterUserInterface" } ``` ### Response #### Success Response (200) - **long** - The unique identifier for the started strategy. #### Response Example ```json { "strategyId": 12345 } ``` ``` -------------------------------- ### Start Strategy for Tester Execution Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterClient Starts a strategy, providing control over the execution process and access to the testing user interface. This overload requires the strategy, a progress listener, an execution controller, and a user interface object. It returns a process ID and can throw exceptions for invalid states or parameters. ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException ``` -------------------------------- ### ITesterClient.startStrategy with ITesterVisualModeParameters Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/tester/class-use/ITesterVisualModeParameters This section details the methods within the ITesterClient class that utilize the ITesterVisualModeParameters interface to start trading strategies. It outlines the parameters required for initiating a strategy, including visual mode parameters. ```APIDOC ## ITesterClient.startStrategy ### Description Starts a trading strategy with specified parameters, including visual mode settings. ### Method `long` ### Endpoint N/A (Java method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strategy** (IStrategy) - Required - The trading strategy to start. - **testerProgressListener** (LoadingProgressListener) - Required - Listener for loading progress. - **testerVisualModeParameters** (ITesterVisualModeParameters) - Required - Parameters for the visual testing mode. - **testerExecution** (ITesterExecution) - Required - Object for test execution. - **testerUserInterface** (ITesterUserInterface) - Required - User interface object for the tester. ### Request Example ```java // Example usage within a Java context long result = testerClient.startStrategy(myStrategy, progressListener, visualModeParams, execution, ui); ``` ### Response #### Success Response (200) - **long** - A unique identifier for the started strategy execution. #### Response Example ```java // Example response (return value of the method) long strategyId = 123456789L; ``` --- ## ITesterClient.startStrategy with ITesterVisualModeParameters and writeHTDataToFiles ### Description Starts a trading strategy, similar to the other `startStrategy` method, but also includes an option to write historical data to files. ### Method `long` ### Endpoint N/A (Java method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **strategy** (IStrategy) - Required - The trading strategy to start. - **testerProgressListener** (LoadingProgressListener) - Required - Listener for loading progress. - **testerVisualModeParameters** (ITesterVisualModeParameters) - Required - Parameters for the visual testing mode. - **testerExecution** (ITesterExecution) - Required - Object for test execution. - **testerUserInterface** (ITesterUserInterface) - Required - User interface object for the tester. - **writeHTDataToFiles** (boolean) - Required - If true, historical data will be written to files. ### Request Example ```java // Example usage within a Java context long result = testerClient.startStrategy(myStrategy, progressListener, visualModeParams, execution, ui, true); ``` ### Response #### Success Response (200) - **long** - A unique identifier for the started strategy execution. #### Response Example ```java // Example response (return value of the method) long strategyId = 987654321L; ``` ``` -------------------------------- ### Get Bar Start Time - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory Calculates and returns the starting time of a bar that encompasses a specified time. This is useful for aligning time-based operations with bar intervals. It throws a JFException if the period is unsupported. ```java long getBarStart(Period period, long time) throws JFException ``` -------------------------------- ### Run Plugin (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/IClient Starts a plugin with a specified exception handler. Requires a `Plugin` object and an `IStrategyExceptionHandler`. ```java java.util.UUID runPlugin(Plugin plugin, IStrategyExceptionHandler exceptionHandler) ``` -------------------------------- ### Get Previous Bar Start Time - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory Retrieves the starting time of the bar that occurred immediately before the bar containing the specified time. This is essential for backtesting or analyzing sequential bar data. It throws a JFException if the period is unsupported. ```java long getPreviousBarStart(Period period, long barTime) throws JFException ``` -------------------------------- ### Start Strategy in Visual Mode Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterClient Launches a strategy specifically for visual mode testing, allowing configuration of visual parameters, execution control, and user interface interaction. This method requires the strategy, progress listener, visual mode parameters, execution controller, and user interface object. It returns a process ID and may throw exceptions. ```java long startStrategy(IStrategy strategy, LoadingProgressListener testerProgressListener, ITesterVisualModeParameters testerVisualModeParameters, ITesterExecution testerExecution, ITesterUserInterface testerUserInterface) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException ``` -------------------------------- ### Get Current Bar Start Time (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory Returns the starting time of the current bar being generated from ticks for a given instrument and period. Returns -1 if no ticks have been received for the instrument. Throws JFException if the period is not supported or the instrument is inactive. ```Java long startTime = getStartTimeOfCurrentBar(instrument, period); ``` -------------------------------- ### IDownloadableStrategies Initialization Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IDownloadableStrategies This section details the 'init' method within the IDownloadableStrategies interface, used for initializing strategies with various configurations. ```APIDOC ## init IDownloadableStrategies ### Description Initializes a downloadable strategy with the provided identifier, name, context, component type, strategy mode, and configuration map. ### Method `init` ### Endpoint N/A (Interface method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "id": "strategy-123", "name": "MyStrategy", "context": "IContext_object", "type": "ComponentType_enum", "mode": "StrategyMode_enum", "configurables": { "setting1": "value1", "setting2": 100 } } ``` ### Response #### Success Response (void or IDownloadableStrategy) - Returns an initialized `IDownloadableStrategy` object upon successful initialization. #### Response Example (Typically no explicit response body for initialization success, may return the initialized object or void) ```json { "status": "initialized" } ``` #### Error Response - `JFException`: Thrown if an error occurs during the initialization process. ``` -------------------------------- ### Get Strategy Initial Deposit - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/ITesterReportData Retrieves the initial deposit amount with which the strategy started. Returns a double value. ```java double getInitialDeposit() ``` -------------------------------- ### Get Start Index for Indicator Calculation Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/HiLowIndicator The `startIndex` method determines the starting index for indicator calculations. It takes the current indicator index and an array of output values as input. This is essential for correctly processing historical data when an indicator is applied to a chart. ```java public int startIndex(int si, java.lang.Object[] outputValues) ``` -------------------------------- ### Plugin onStart Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/plugins/Plugin The onStart method is called when a plugin begins its execution. It receives an IPluginContext object that provides access to system functionalities. ```java public void onStart(IPluginContext context) throws JFException ``` -------------------------------- ### Get Start Time of Current Bar Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory Returns the starting timestamp of the bar that is currently being formed by incoming ticks for a specified instrument and period. If no ticks have been received for the instrument, it returns -1. This operation can throw a `JFException` if the period is unsupported or the instrument is inactive. Requires `IFinancialInstrument` and `Period`. ```java @Deprecated long getStartTimeOfCurrentBar(IFinancialInstrument financialInstrument, Period period) throws JFException ``` -------------------------------- ### GaussianChannel onStart Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/GaussianChannel Called once when the indicator is initialized. It receives an IIndicatorContext object, which provides access to system functionalities needed for indicator setup. ```java public void onStart(IIndicatorContext context) ``` -------------------------------- ### Get Next Bar Start Time - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IHistory Determines and returns the starting time of the bar immediately following the bar that includes a given time. This method is useful for iterating through historical data or scheduling future events based on bar intervals. It throws a JFException if the period is unsupported. ```java long getNextBarStart(Period period, long barTime) throws JFException ``` -------------------------------- ### Strategy Management API Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/IClient APIs for starting, stopping, and managing trading strategies. ```APIDOC ## POST /strategies/start ### Description Starts a trading strategy with a default exception handler that stops the strategy if it throws an exception. ### Method POST ### Endpoint /strategies/start ### Parameters #### Request Body - **strategy** (IStrategy) - Required - The strategy object to run. ### Request Example ```json { "strategy": { "//": "Strategy object definition would go here" } } ``` ### Response #### Success Response (200) - **processId** (long) - The unique ID assigned to the started strategy. #### Response Example ```json { "processId": 12345 } ``` ### Errors - **java.lang.IllegalStateException**: If the client is not connected. - **java.lang.NullPointerException**: If the strategy parameter is null. ``` ```APIDOC ## POST /strategies/start/custom-handler ### Description Starts a trading strategy with a custom exception handler. ### Method POST ### Endpoint /strategies/start/custom-handler ### Parameters #### Request Body - **strategy** (IStrategy) - Required - The strategy object to run. - **exceptionHandler** (IStrategyExceptionHandler) - Optional - The custom exception handler to be called when the strategy throws an exception. ### Request Example ```json { "strategy": { "//": "Strategy object definition" }, "exceptionHandler": { "//": "ExceptionHandler object definition" } } ``` ### Response #### Success Response (200) - **processId** (long) - The unique ID assigned to the started strategy. #### Response Example ```json { "processId": 67890 } ``` ### Errors - **java.lang.IllegalStateException**: If the client is not connected. - **java.lang.NullPointerException**: If the strategy parameter is null. ``` ```APIDOC ## POST /strategies/{processId}/stop ### Description Stops a running strategy identified by its process ID. ### Method POST ### Endpoint /strategies/{processId}/stop ### Parameters #### Path Parameters - **processId** (long) - Required - The ID of the strategy to stop. ### Response #### Success Response (200) - **status** (string) - Indicates that the stop request has been processed. #### Response Example ```json { "status": "stop_requested" } ``` ``` ```APIDOC ## POST /plugins/{processId}/stop ### Description Stops a running plugin identified by its process ID. ### Method POST ### Endpoint /plugins/{processId}/stop ### Parameters #### Path Parameters - **processId** (UUID) - Required - The ID of the plugin process to stop. ### Response #### Success Response (200) - **status** (string) - Indicates that the stop request has been processed. ``` -------------------------------- ### Plugin Initialization with IPluginContext (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/plugins/class-use/IPluginContext Demonstrates the `onStart` method of the Plugin class, which receives an `IPluginContext` object upon plugin initialization. This context is crucial for accessing Dukascopy platform functionalities required by the plugin. No external dependencies are needed beyond the Dukascopy API. ```java /** * Called on plugin start. * @param context The IPluginContext provided by the Dukascopy platform. */ void onStart(IPluginContext context); ``` -------------------------------- ### Get Last 30 Days Turnover at Start (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/system/Commissions Retrieves turnover values for the last 30 days, used at tester start time. By default, all values are initialized to zero. Modifications to the returned array will affect the 'Commissions' class. This method returns an array of doubles representing turnover values. ```java public double[] getLast30DaysTurnoverAtStart() { // Implementation details not provided in the source text return new double[30]; // Placeholder for return type } ``` -------------------------------- ### Java Method: getIndexOfFirstCandleOnScreen() Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/indicators/IIndicatorDrawingSupport Gets the index of the very first candle that is currently displayed on the screen. This is useful for calculations that need to reference the starting point of the visible data range. ```java int getIndexOfFirstCandleOnScreen() { // Index in the array of values and candles. } ``` -------------------------------- ### IStrategies.startStrategy (Deprecated) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/IStrategyListener These methods allow starting a strategy with an IStrategyListener, but are deprecated in favor of IClient.startStrategy(IStrategy). ```APIDOC ## POST /api/strategies/start ### Description Starts a trading strategy with a provided listener and configuration. This method is deprecated and users should migrate to `IClient.startStrategy(IStrategy)`. ### Method POST ### Endpoint /api/strategies/start ### Parameters #### Query Parameters - **listener** (IStrategyListener) - Required - An instance of IStrategyListener to receive strategy events. - **fullAccess** (boolean) - Optional - Grants full access to the strategy. #### Request Body - **jfxFile** (java.io.File) - Required - The JFX file for the strategy. - **configurables** (Map) - Optional - A map of configurable parameters for the strategy. ### Request Example ```json { "jfxFile": "path/to/strategy.jfx", "configurables": { "param1": "value1", "param2": 123 } } ``` ### Response #### Success Response (200) - **strategyId** (long) - The unique identifier for the started strategy. #### Response Example ```json { "strategyId": 1234567890 } ``` ## POST /api/strategies/start (Deprecated) ### Description Starts a trading strategy with a provided listener. This method is deprecated and users should migrate to `IClient.startStrategy(IStrategy)`. ### Method POST ### Endpoint /api/strategies/start ### Parameters #### Query Parameters - **listener** (IStrategyListener) - Required - An instance of IStrategyListener to receive strategy events. - **fullAccess** (boolean) - Optional - Grants full access to the strategy. #### Request Body - **strategy** (IStrategy) - Required - The strategy object to be started. ### Request Example ```json { "strategy": "com.example.MyStrategy" } ``` ### Response #### Success Response (200) - **strategyId** (long) - The unique identifier for the started strategy. #### Response Example ```json { "strategyId": 1234567890 } ``` ``` -------------------------------- ### MAXIndicator onStart Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/MAXIndicator This method is called once when the indicator is initialized. It receives an IIndicatorContext object that provides access to system functionalities. This is a required method from the IIndicator interface. ```java public void onStart(IIndicatorContext context) ``` -------------------------------- ### Get Strategies Interface (Java) Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/IContext Retrieves an interface that provides functionality to start, stop, and control other strategies. This method is deprecated and users should instead use `IClient.startStrategy(IStrategy)`. ```java /** * @deprecated * use IClient.startStrategy(IStrategy) instead * Returns interface that allows to start/stop and control other strategies * * @return IStrategies implementation */ @Deprecated IStrategies getStrategies() ``` -------------------------------- ### History API - getNextBarStart Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/class-use/JFException Calculates the start time of the next bar following a given bar time. ```APIDOC ## GET /api/history/nextBarStart ### Description Returns the starting time of the bar that comes immediately after the bar containing the specified bar time. ### Method GET ### Endpoint `/api/history/nextBarStart` ### Parameters #### Query Parameters - **period** (Period) - Required - The time period of the bars. - **barTime** (long) - Required - The timestamp of the bar for which to find the next bar's start time. ### Response #### Success Response (200) - **nextBarStartTime** (long) - The starting timestamp of the next bar. #### Response Example ```json { "nextBarStartTime": 1678976400000 } ``` ``` -------------------------------- ### Get Shifted Time Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/indicators/IIndicatorDrawingSupport Calculates a shifted time value based on a starting time and a number of candles to shift. This method is useful for time-series analysis and aligning data points. ```java long getShiftedTime(long time, int shift) ``` -------------------------------- ### AwesomeOscillator onStart Method Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/indicators/AwesomeOscillator Called on indicator initialization. This method is part of the IIndicator interface and is used to set up the indicator with the provided context. ```java public void onStart(IIndicatorContext context) // Called on indicator initialization ``` -------------------------------- ### Get Formula Values List From - Java Source: https://www.dukascopy.com/client/javadoc3/com/dukascopy/api/indicators/IFormulaTimeData Retrieves a list of formula values from a specified starting bar (inclusive/exclusive) for a given output index. Useful for fetching values from a point onwards. ```java java.util.List getFormulaValuesFrom(ITimedData fromBar, boolean fromInclusive, int outputIndex) ```