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

How to run a strategy in several instruments
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=146&t=54164
Page 1 of 1

Author:  juandata [ Wed 06 Jul, 2016, 00:22 ]
Post subject:  How to run a strategy in several instruments

Hello Dukascopy Community,

I am trying to figure out how to build a strategy and then run the same strategy in more than one instrument using visualjforex.

The strategy sample is called "MultipleInstruments1", which you can download. The logic is simple: the strategy opens a buy position when SMA short crossover SMA long from below and viceversa.

Now I want this strategy to run in more than one instrument, lets say two, so I create a new strategy called "MultipleInstruments2" and add "MultipleInstuments1" as a strategy block as mentioned here: https://www.dukascopy.com/vfhelper/arti ... _locale=EN

the problem is that if I try to change any variable, for example the SMA long time period (I want to change it from 50 periods to 100 periods)

Image

I always get a server error message when building it:

Image

How can I do this? I build a strategy for a client, which took me weeks, and is way way more complex than this one, and there is only one thing left to do, duplicate the strategy so it can be run in several instruments. How can you do that with strategy blocks? and if is not possible, what is the use of strategy blocks?

Thanks, I reallly appreciate your help on this.

Attachments:
3.PNG [178.46 KiB]
Downloaded 827 times
MultipleInstruments1.vfs [28.62 KiB]
Downloaded 223 times
MultipleInstruments2.vfs [14.08 KiB]
Downloaded 222 times

Author:  amine_chourou [ Wed 06 Jul, 2016, 21:04 ]
Post subject:  Re: How to run a strategy in several instruments

Hi,

There is an easier way to run your strategy on many instruments:
- Get your strategy on a single instrument (full strategy in blocks not the embedded one as a single block)
- Save it and create as more copies as you want on other instruments then run different strategies on your instruments separately.

If you have any condition related to position limitation, let me know as there is some adjustments to be done.

Author:  Ristoril [ Thu 27 Oct, 2016, 01:23 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Hi,

There is an easier way to run your strategy on many instruments:
- Get your strategy on a single instrument (full strategy in blocks not the embedded one as a single block)
- Save it and create as more copies as you want on other instruments then run different strategies on your instruments separately.

If you have any condition related to position limitation, let me know as there is some adjustments to be done.



hey amine can you show this?

basically I made entry strategy for 1 instrument, that I want to set up on all the instruments i want to buy/sell that day. I ran multiple copies, but i want position to stay at 1 for each instrument.

So , what I want is when i get a signal on EURUSD, it sells 1 position and only 1, but if USDCAD gets signal it would open there too. TY

Author:  amine_chourou [ Thu 27 Oct, 2016, 10:41 ]
Post subject:  Re: How to run a strategy in several instruments

Hi there !

The idea is to avoid the use of any condition with "Position Amount" as this variable looks for any open position regardless of the traded instrument.
The example attached above "MultipleInstruments1" shows the way the number of open positions are handled with the Boolean variable "Opened_Positions" and the way it switches to true/False. You should implement the same logic and then run your strategies on the needed instruments.
How many instruments are you planning to use ?

Thanks

Author:  amine_chourou [ Thu 27 Oct, 2016, 10:43 ]
Post subject:  Re: How to run a strategy in several instruments

Here is the same example slightly modified...

Attachments:
MultipleInstruments1_V2.vfs [30.64 KiB]
Downloaded 299 times

Author:  Ristoril [ Thu 27 Oct, 2016, 11:38 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Hi there !

The idea is to avoid the use of any condition with "Position Amount" as this variable looks for any open position regardless of the traded instrument.
The example attached above "MultipleInstruments1" shows the way the number of open positions are handled with the Boolean variable "Opened_Positions" and the way it switches to true/False. You should implement the same logic and then run your strategies on the needed instruments.
How many instruments are you planning to use ?

Thanks



20 ish in total , probably 3-7 instances of the strategy running a day

Author:  Ristoril [ Thu 27 Oct, 2016, 11:53 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Here is the same example slightly modified...


ill give it a whirl , ty amine

Author:  kawjansen [ Thu 10 Nov, 2016, 21:07 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Hi,

There is an easier way to run your strategy on many instruments:
- Get your strategy on a single instrument (full strategy in blocks not the embedded one as a single block)
- Save it and create as more copies as you want on other instruments then run different strategies on your instruments separately.

If you have any condition related to position limitation, let me know as there is some adjustments to be done.



Hi Amine!

Jumping on the bandwagon, I've got multiple strategies, and multiple positions in each strategy, but I can't make it work! I've used the "position amount" block for all my strategies until now. But I as you said, it counts all positions.

I've tried to make a count using the trade event messages, but that didn't work. I also read about using the brown comments blocks, but I never used them...

Any advice?

Thanks in advance,

Koen

Author:  foreignexchange [ Fri 11 Nov, 2016, 09:15 ]
Post subject:  Re: How to run a strategy in several instruments

Hello great,

but for example spread strategies between two pairs it could be utilized the visual VJF ?
Suppose you have two correlated pairs P1 and P2 and you can assume that both are correlated with a commodity.
When the commodity is bullish the tendency is that both the pair are bullish. Suppose that one (P2) have a lower gain in comparison
to the other (P1).
And suppose that you want to try to make profit from this, buying P1 and selling P2.
The strategy should calculate P1 and P2 in the same procedure to suggest an entry.

Is that in VJF possible ?

Author:  amine_chourou [ Fri 11 Nov, 2016, 15:00 ]
Post subject:  Re: How to run a strategy in several instruments

Hi !

@kawjansen

This is feasible using customized variable that acts as logical trigger for each currency pair. can you attach your strategy so that I can have a look ?
If you wish to keep it private, you can send to support @dukascopy.com and address your email to me.

@foreignexchange

Quote:
But for example spread strategies between two pairs it could be utilized the visual VJF ?


Yes it is. Check the attached example.

Cheers

Attachments:
Example_multi.vfs [32.47 KiB]
Downloaded 241 times

Author:  foreignexchange [ Fri 11 Nov, 2016, 15:25 ]
Post subject:  Re: How to run a strategy in several instruments

:D ;)

Author:  kawjansen [ Fri 11 Nov, 2016, 17:53 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Hi !

@kawjansen

This is feasible using customized variable that acts as logical trigger for each currency pair. can you attach your strategy so that I can have a look ?
If you wish to keep it private, you can send to support @dukascopy.com and address your email to me.

@foreignexchange

Quote:
But for example spread strategies between two pairs it could be utilized the visual VJF ?


Yes it is. Check the attached example.

Cheers



For sake of simplicity (also to other people seeking support) can you please use the SMA example used above?

Kind regards,

Koen

Author:  amine_chourou [ Wed 16 Nov, 2016, 12:48 ]
Post subject:  Re: How to run a strategy in several instruments

Here it is ...

Attachments:
MultipleInstruments1_V3.vfs [41.58 KiB]
Downloaded 286 times
MultipleInstruments1_V3.vfs [41.07 KiB]
Downloaded 282 times

Author:  Illya [ Thu 17 Nov, 2016, 13:09 ]
Post subject:  Re: How to run a strategy in several instruments

Greetings Amine!
I have a question that relates to this topic.
How to get a signals from another instruments, but to trade only one? Cross logic system.

File sent you via email.

Author:  kawjansen [ Thu 17 Nov, 2016, 18:38 ]
Post subject:  Re: How to run a strategy in several instruments

First of all, thank you Amine. It's really good to have some support around in case when you need it.

As for Illya, if you need signals from other currency pairs, I'd use the "get historical candle(s)" blocks and the the instrument to a fixed one (or create a variable to keep consistency). And use the new candle to compute signals. For indicators you can do the same.

Author:  kawjansen [ Thu 17 Nov, 2016, 18:39 ]
Post subject:  Re: How to run a strategy in several instruments

kawjansen wrote:
First of all, thank you Amine. It's really good to have some support around in case when you need it.

As for Illya, if you need signals from other currency pairs, I'd use the "get historical candle(s)" blocks and the the instrument to a fixed one (or create a variable to keep consistency). And use the new candle to compute signals. For indicators you can do the same.


He also shows it in the Multiple instruments V3

Author:  Illya [ Thu 17 Nov, 2016, 19:11 ]
Post subject:  Re: How to run a strategy in several instruments

Ďakujem za Vašu odpoveď, Kawjansen. Budem sledovať na vašu radu!
You get straight to the point.

Author:  kawjansen [ Tue 06 Mar, 2018, 20:38 ]
Post subject:  Re: How to run a strategy in several instruments

amine_chourou wrote:
Here is the same example slightly modified...



Exactly what I was looking for!

Thanks!

  Page 1 of 1