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.

"Add multiple charts"
 Post subject: "Add multiple charts" Post rating: 0   New post Posted: Tue 30 Oct, 2012, 22:37 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
So I've read the overview provided here with excitement:
https://www.dukascopy.com/wiki/#JForex_S ... ple_charts

Only to find that the platform seems to allow me to open a chart for EUR/USD and GBP/USD in one window but for some reason
it doesn't allow me to achieve EUR/USD Daily and EUR/USD Hourly in one window i.e is multiple timeframes on the same instrument.

I've tried 2 subscriptions to EUR/USD.
I've tried a subscription to EUR/USD and GBP/USD then doing a setInstrument(EUR/USD) on the GBP/USD feedDescriptor in setChartPanels(Map<IChart, ITesterGui> chartPanels).

Anyone know how do I achieve this?


 
 Post subject: Re: "Add multiple charts" Post rating: 0   New post Posted: Tue 18 Dec, 2012, 18:04 
User avatar

User rating: 70
Joined: Sat 22 Sep, 2012, 17:43
Posts: 118
Location: Brazil, Fortaleza, Ceará
Ok so with some manipulation I've been able to figure this out - not since I posted it but just in the last 20 minutes.

EUR/USD WEEKLY / EUR/USD DAILY / EUR/USD 4 HOUR within the Strategy Tester

by doing the following

3 Subscriptions by 3 Strategies to EUR/USD - causes SetChartPanels to be called 3 times - one for each panel to appear in the tester

But I don't want the strategy running 3 times, so I use one main strategy and 2 strategies just to render indicators (no trading logic)

4 HOUR STRATEGY - MAIN/INDICATOR STRATEGY
DAILY STRATEGY - INDICATOR STRATEGY
WEEKLY STRATEGY - INDICATOR STRATEGY

When SetChartPanels is called there will be at least 1 panel given in the set (maybe two if your account currency isn't EUR/USD)

For each call to SetChartPanels (called in the order of the strategy subscriptions) I work out which strategy the call is for then search
the set of panels given for the strategies currency (that means getting rid of the chartPanels.keySet().iterator().next();
that's there by default and assigning it like this Iterator<IChart> i = chartPanels.keySet().iterator() so you iterate over it.
When the panel is picked up, depending on which strategy the call is for I set feed descriptor datatype, offerside, instrument, period, filter, etc
then add that panel.

After all 3 calls the tester comes up with 3 sections on EUR/USD showing 3 timeframes with only one timeframe actively trading but with all
the indicators and so on needed on the other timeframes.

SIDE NOTE / TIP JUST IN CASE:
When SetChartPanels is called there will be at least 1 panel given in the Set (maybe two if your account currency isn't EUR/USD).
If u ever start the tester and sometimes notice it jams up with no indicator rendering or no panel rendering at all - if you use the
GUI testing example that comes in the lib it's likely because the incoming Set including the subscribed currencies is out of order
not allowing the
chartPanels.keySet().iterator().next(); to pick up the right currency.
E.g. you subcribe to EUR/USD but ur account is GBP, most times the incoming set comes into SetChartPanels as {EUR, GBP}
allowing the next() to pick it up. But sometimes it comes in as {GBP, EUR} meaning next() picks up the wrong one and throws
the GUI off from there.


All the best folks!


 

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