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.

how can i change instrument in TesterMainGUIMode
 Post subject: how can i change instrument in TesterMainGUIMode Post rating: 0   New post Posted: Thu 31 Oct, 2013, 21:54 
User avatar

User rating: 9
Joined: Sun 18 Dec, 2011, 03:31
Posts: 160
Location: Egypt, Cairo
i use netbeans to debug my strategy it work correctly when i use eur/usd but when i change it to aud/jpy it didn't work correctly
i just changed all instrument (in source code) eurusd to audjpy in TesterMainGUIMode,MainTesterMain,OrderTableFromSdk,Main

and i also added this code in TesterMainGUIMode to change time interval

Code: final SimpleDateFormat dateFormat;
dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
dateFrom = dateFormat.parse("05/01/2013 12:00:00");
dateTo = dateFormat.parse("05/22/2013 00:00:00");
client.setDataInterval(DataLoadingMethod.ALL_TICKS, dateFrom.getTime(), dateTo.getTime());

after this code (after subscribe instrument)
final Set<Instrument> instruments = new HashSet<Instrument>();
instruments.add(Instrument.AUDJPY);

is it correctly?

all this in attach file


 
 Post subject: Re: how can i change instrument in TesterMainGUIMode Post rating: 1   New post Posted: Fri 01 Nov, 2013, 14:28 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

What error do you got? Or what do you mean with 'it didn't work correctly'?


 
 Post subject: Re: how can i change instrument in TesterMainGUIMode Post rating: 0   New post Posted: Fri 01 Nov, 2013, 14:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tcsabina wrote:
What error do you got? Or what do you mean with 'it didn't work correctly'?
On top of that, please provide only the programs that replicate the case.


 
 Post subject: Re: how can i change instrument in TesterMainGUIMode Post rating: 0   New post Posted: Tue 05 Nov, 2013, 06:37 
User avatar

User rating: 9
Joined: Sun 18 Dec, 2011, 03:31
Posts: 160
Location: Egypt, Cairo
API Support wrote:
tcsabina wrote:
What error do you got? Or what do you mean with 'it didn't work correctly'?
On top of that, please provide only the programs that replicate the case.

If you change instrument in TesterMainGUIMode.java from Instrument.EURUSD to Instrument.AUDJPY
and run MA_Play Strategy you will see that subscribe instrument is USDJPY!! not AUDJPY , why i don't know ?

Like the picture attached
Image


 
The Best Answer  Post subject: Re: how can i change instrument in TesterMainGUIMode Post rating: 0   New post Posted: Tue 05 Nov, 2013, 15:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is due to the fact that the USD/JPY instrument gets subscribed for value-conversion API methods. Consider checking the chart's instrument, before adding it:
@Override
public void setChartPanels(Map<IChart, ITesterGui> chartPanels) {
    for(Map.Entry<IChart, ITesterGui> entry : chartPanels.entrySet()){
        IChart chart = entry.getKey();
        JPanel chartPanel = entry.getValue().getChartPanel();
        if(chart.getFeedDescriptor().getInstrument().equals(Instrument.AUDJPY)){
            setTitle(chart.getFeedDescriptor().toString());   
            addChartPanel(chartPanel);
            break;
        }
    }
}
The example will get updated with the next JForex-SDK release.


 

Jump to:  

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