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.

Please explain how a strategy is called
 Post subject: Please explain how a strategy is called Post rating: 0   New post Posted: Tue 30 Jun, 2009, 20:50 

User rating: 0
Joined: Tue 30 Jun, 2009, 20:38
Posts: 17
Hello, I am new to Java and new to jForex, but I am familiar with MT4, C/C++, and C# and I am picking up Java pretty easily. I have a question about how jForex handles multi-currency strategies though. Before developing my trading robot I am first creating a script to download data and format it correctly so that the robot I make in the future can import the data.

My goal is to have one data file that contains the current price for every instrument that jForex supports on each line, so a line in this file looks like this:

2009.01.01.24.59.01.AUDPRICE.CADPRICE.CHF.EUR.GBP.JPY.NZD.USD.....

That is the year, the month, the day, the hour, the minute, the second, then first pair, then second pair, then third pair, and so on. This is my goal, but I cannot create this easily without knowing more about how jForex calls a script.

I believe that when you select multiple pairs to run a script on, jForex will run an instance of the script on the first pair, then once that is complete it will start another instance on the second pair, then the third, and so on. Is this correct? Or can it start one instance and look at each currency pair on every tick/bar?

I would greatly appreciate and help or guidance that anybody can offer as I cannot proceed with implementing my strategy until I understand more about how jForex handles multi-currency strategies. Thanks.


 
 Post subject: Re: Please explain how a strategy is called Post rating: 0   New post Posted: Tue 30 Jun, 2009, 21:06 

User rating: 0
Joined: Tue 30 Jun, 2009, 20:38
Posts: 17
I have examined the MA_Play example more closely, and I think I have determined that jForex behaves like this:

User selects currency pairs to run script on and start-end dates for testing, and period to test on
jForex:
starts new testing instance
for each bar/tick in selected time window
{
for each currency in selection
{
call onTick or onBar method in strategy
}
}

So, say I were to select EUR/USD and GBP/USD for testing on, and a 15 minute period and open prices, then jForex would call onBar(EUR/USD) followed by onBar(GPB/USD) every 15 minutes, right?


 
 Post subject: Re: Please explain how a strategy is called Post rating: 0   New post Posted: Wed 01 Jul, 2009, 08:24 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,
tester reads data files with ticks/bars for every currency pair simultaneously and pass them to the strategy sorted by time. You get ticks and bars same as you would get them in real time system, e.g. tick_EURUSD@19sec365ms, tick_EURUSD@19sec789ms, tick_EURGBP@19sec864ms, 10secBar_EURUSD@20sec000ms, 10secBar_EURGBP@20sec000ms, tick_EURUSD@20sec637ms etc.

period that you select in tester defines how ticks are generated, if you select 15min and interpolation "Tick on open" then you will get ticks only every 15mins with a prices based on open prices of the 15mins candles. This is useful when your strategy is based on bars and doesn't need so many ticks, reducing them will speed up testing process


 
 Post subject: Re: Please explain how a strategy is called Post rating: 0   New post Posted: Wed 01 Jul, 2009, 16:22 

User rating: 0
Joined: Tue 30 Jun, 2009, 20:38
Posts: 17
So my reply to my original post is correct? On eash bar open jForex will call the onBar() method from my strategy 22 times in a row, each time passing it a different instrument (assuming all 22 instruments are selected in the tester)?


 
 Post subject: Re: Please explain how a strategy is called Post rating: 0   New post Posted: Wed 01 Jul, 2009, 16:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Yes, it's correct, onBar will be called for every instrument


 

Jump to:  

  © 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