Dukascopy
 
 
Wiki JStore Search Login

Strategy iteration fails to find chart if Instrument changed
 Post subject: Strategy iteration fails to find chart if Instrument changed Post rating: 0   New post Posted: Thu 21 Nov, 2013, 15:28 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
I've observed this in the past, but this is using
Live JForex FXDD ver 2.28.5 with JForex API ver. 2.9.4

It appears to me that there is a bug in the API or in JForex's structures
relating to charts when a local Strategy attempts to iterate through
available charts based on Instrument.

When the chart is created from the "Instruments" area in JForex
using "Open Chart" then it is always found as expected.

But if the chart Instrument is subsequently changed, or if the
chart is created through "cloning" of another chart, then
the Strategy may be unable to detect the chart through iteration
based upon the Instrument.

Here is a snippet of the code used to search for charts
with a given instrument, which is either TICK or has an
interval period less than 3 minutes. For these charts
the code would then do something like place graphic
objects on the chart.

It appears that either the Instrument is not recognized
or the other selection criteria fail, unless the chart is
created "fresh" using "Open Chart" from the Instruments
area in JForex.

Issues arise if the chart is "cloned" from another chart
or apparently if the chart Instrument is changed to
match the instrument this code is searching for, but
is then unable to recognize.

I wonder if anybody else has seen or suspected a problem
like this? There's an easy workaround, which is always
to create charts using "Open Chart", but there seems
to be some underlying bug here.

So, to be clear. While the Strategy is already running, and
it has detected some chart(s). Then if we add another
chart by changing an existing chart from one other Instrument
to match the Instrument the Strategy is searching for,
we would expect the Strategy could then detect that
additional chart, but seems not to recognize it ?

Perhaps getCharts(instrument) is not seeing the new chart
in the collection.....

HyperScalper


           Set<IChart> charts = context.getCharts(instrument); // e.g. EUR/USD
           for (IChart chart : charts) {
              boolean useThisChart = false;
              if (chart.getSelectedPeriod()==Period.TICK) {
                 useThisChart=true; // specifically check for a tick chart
              }
              if (!useThisChart) {
                     Period period = chart.getSelectedPeriod();
                     Unit unit = period.getUnit();
                     // then also check for 3 minute or less Period chart
                 if (unit.getInterval()<=180000) useThisChart=true;
              }
              if (!useThisChart) continue; // skip this chart
              // place marks on this chart, since it is
              // either a TICK chart of has an interval short enough
           }


 
 Post subject: Re: Strategy iteration fails to find chart if Instrument changed Post rating: 0   New post Posted: Tue 26 Nov, 2013, 15:36 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We did not observe any error when cloning the chart (we ran the attached strategy and did manual chart actions in the platform). The issue with manually changed instrument will be fixed with JForex-API 2.9.5.


Attachments:
GetChartsByInstrument.java [1.56 KiB]
Downloaded 247 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.
 

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