Dukascopy
 
 
Wiki JStore Search Login

write technical indicators to CSV when taking a trade
 Post subject: write technical indicators to CSV when taking a trade Post rating: 0   New post Posted: Tue 23 Apr, 2019, 13:22 

User rating: 0
Joined: Mon 14 Nov, 2011, 05:16
Posts: 33
Location: PhilippinesPhilippines
Dear Support,

I am trying to write various technical indicators to csv file, when I take a trade (to analyse correlation)

I use this code in the onBar Function

            if (bidPrice < prevWeekLow) {
               sell(instrument, engine, profitLimit, lossLimit, 0.1);
               try {       
           out.append( sdf2.format(bidBar.getTime()) + ";" + bidPrice )
           .append(";" + openPrice)
           .append(";" + sma14).append(";" + ema12).append(";" +sma50).append(";" + ema26).append(";" + sma200)
           .append("\n");   
         
         } catch (IOException e) {
            writeMessage("File write error " );
            e.printStackTrace();


found on this strategy-api page:
https://www.dukascopy.com/wiki/en/devel ... ars-in-csv

This, however, prints the indicators to CSV file for each bar, and not - as intended - only when a trade is taken.

Can you guide me to a functional solution? It would be helpful if the code also prints the result of the trade (open, close, profit in Pips) at the close of that trade


 

Jump to:  

cron
  © 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