Dukascopy
 
 
Wiki JStore Search Login

Converted EA not subscribing to multiple Instruments
 Post subject: Converted EA not subscribing to multiple Instruments Post rating: 0   New post Posted: Mon 23 Jun, 2014, 08:06 
User avatar

User rating: 1
Joined: Fri 14 Sep, 2012, 02:25
Posts: 57
Location: New Zealand, Christchurch
The attached EA needs to subscribe to the two Symbol() strings declared, else order entry for one (or the other) fails.
Can you please confirm what MQL4 syntax is required in order to get both (or more than one) Instrument subscribed?

NOTE: this is just a simple MQL4 example that converts OK but then fails to run-
what I need to understand is the mql4 synatx required in order that I can subscribe to multiple Instruments -
OR is this not available in the conversion to .jfx ?


Attachments:
Simple Hedger v1.04.mq4 [9.21 KiB]
Downloaded 142 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Converted EA not subscribing to multiple Instruments Post rating: 0   New post Posted: Fri 11 Jul, 2014, 15:57 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
https://docs.mql4.com/marketinformation/symbolselect - this is the function you need.

Here is example of how your init function could look to make the strategy work:

int init(){
   lots=initiallots;
   dg=Digits;
   
   SymbolSelect(symbol1, true);
   SymbolSelect(symbol2, true);
   
   return(0);
}


But, unfortunately, there is some limitations of SymbolSelect usage in JForex:
1) you can't subscribe to instruments from indicators
2) you can't unsubscribe from instruments (for both strategies and indicators)


 
 Post subject: Re: Converted EA not subscribing to multiple Instruments Post rating: 0   New post Posted: Wed 16 Jul, 2014, 06:52 
User avatar

User rating: 1
Joined: Fri 14 Sep, 2012, 02:25
Posts: 57
Location: New Zealand, Christchurch
Thank you - this compiles OK, but I get:
Strategy tester: java.lang.UnsupportedOperationException @ jforex.converted.SimpleHedgerv104.init(SimpleHedgerv104.java:236)
on running in Historical tester.


Attachments:
Simple Hedger v1.04.mq4 [9.28 KiB]
Downloaded 175 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Converted EA not subscribing to multiple Instruments Post rating: 0   New post Posted: Wed 16 Jul, 2014, 16:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is Converter's bug. That bug is fixed in the next API release. It will be available on DEMO in the next few weeks.

As a temporary workaround, you can comment out SymbolSelect function calls and recompile before running strategy in Historical Tester, and it should work fine. But don't forget to select appropriate instruments in Historical Tester (Historical Tester tab > Instruments button).

Also you can avoid using programmatic subscribe via SymbolSelect and subscribe to instruments manually using Instruments panel on the left side of JForex Platform. In that case you can completely remove SymbolSelect usage.


 

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