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.

Is the API Incomplete?
 Post subject: Is the API Incomplete? Post rating: 0   New post Posted: Thu 09 Dec, 2010, 05:28 

User rating: 0
Joined: Thu 02 Dec, 2010, 16:55
Posts: 15
Does anyone else but me feel like this is a really incomplete API? And feel that the design needs a lot of improvement? To me, it feels like a C Programmer learned Java and tried to learn OOP, but the design isn't really there.

Take indicators. There is one way to use an indicator in a strategy and a totally different way to use it in an indicator. It is like 2 people designed each part without talking to each other.

I haven't seen any use of the Template Method pattern (or any abstract classes for that matter) when it could be used to make life much simpler for someone learning JForex.

Writing strategies can really be so simple with the right API!


 
 Post subject: Re: Is the API Incomplete? Post rating: 0   New post Posted: Fri 10 Dec, 2010, 11:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
SunSun wrote:
Does anyone else but me feel like this is a really incomplete API? And feel that the design needs a lot of improvement? To me, it feels like a C Programmer learned Java and tried to learn OOP, but the design isn't really there.

The idea was to make it simple to use not only for pro programers, but also for traders willing to write strategies and lear java in the process. "True" java designs with different programing patterns with OOP models etc are hard to understand and use for people whose usual job is not to program.
SunSun wrote:
Take indicators. There is one way to use an indicator in a strategy and a totally different way to use it in an indicator. It is like 2 people designed each part without talking to each other.

The difference in design arise from the different use. When strategy uses indicator it can request any data it wants by passing from-to, shift or number of candles and time. But indicators also used in different places like charts. In charts we dont need to pass from-to times to the indicator, we already have the data in buffer and need to calculate indcator values for this data and do that instantly.


 
 Post subject: Re: Is the API Incomplete? Post rating: 0   New post Posted: Fri 10 Dec, 2010, 15:40 

User rating: 1
Joined: Fri 26 Mar, 2010, 19:19
Posts: 116
Location: Canada
so.... is there any plan to rework the indicators API at least? Few of us would like to jump through fires and fight dragons just to do anything beyond grade school math. Something more OO friendly would be appreciated, so that some of us in the community can build a framework on top of it. Please?


 
 Post subject: Re: Is the API Incomplete? Post rating: 0   New post Posted: Fri 10 Dec, 2010, 17:22 

User rating: 0
Joined: Thu 02 Dec, 2010, 16:55
Posts: 15
Patterns are used to simplify. Barebones implementations, where the programmer implements interfaces is great for pro programmers. Not for beginners. Having 2 systems are what programmers would want, dealing with speed... not beginners.

Take the interface IIndicators. That is just an interface, there is no concrete implementation. You get a concrete implementation from the context. The concrete class implementing the interface handles that. It could handle it differently in a strategy vs a indicator, but the interface can be the same. That is the entire purpose of an interface. That is why it simplifies things. One interface, 2 means to get the same results.

To make it feasible without breaking things, you add a method to the indicators context that allows you to retrieve the same interface as you do in the strategies context. And then create a concrete implementation of that interface that uses the indicators approach.

As far as a framework on top, we can do that in any number of ways. There is a pattern called the Facade pattern that is used to create a simple interface into a complex series of systems. We could write a facade to the indicators that cleans it up and makes it user friendly without changing any of the provided jforex interfaces. Effectively, you could use the IIndicators interface used in strategies to create a facade into the indicators way of doing things. So from the programmers perspective, they don't care how they get the data... they just want the data in an easy to understand way.

That is why I say it appears incomplete. It hasn't been made for the end user, it's been made for the professional programmer. There are soooooo many ways you can simplify things for the end user here.


 
 Post subject: Re: Is the API Incomplete? Post rating: 0   New post Posted: Fri 10 Dec, 2010, 18:27 

User rating: 0
Joined: Thu 02 Dec, 2010, 16:55
Posts: 15
On another note, I can look at indicators in multiple time frames from the strategy, but not from the indicators. I wrote an indicator for MT4 that I like to use that is convergence/divergence of moving averages on different time frames. I noticed a pattern that when the 5 minute, 15 minute, 30 minute long term (around 80) moving averages converge, it was getting close to a breakout in one direction. So I wrote an indicator that shows the maximum divergence of those 3 moving average values.

I don't think it is possible write that with the current way of writing indicators. But... it IS possible if you write a strategy and use a pane below similar to the example for Market Depth. Which to me, is a bit strange.. that I'd have to write a strategy to do an indicators job.


 

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