|
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.
Need some code examples |
[Saidar]
|
Post subject: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 10:56
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
Hey,
Can someone please give me some examples to do the following:
Open price of a bar Close price of a bar High price of a bar Low price of a bar
Highest price of an array of bars Lowest price of an array of bars
Can someone also please explain to me why there is no coding tips while coding? For instance if I want to code a simple moving average, the code looks like this:
double sma50 = this.indicators.sma(instrument, period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE, 50, 0);
There is no incode tips saying what variable I'm working with now or what parameters is required etc...
How am I and other coders supposed to know where the parameters should come and in what sequence? I cannot find any documentation learning new users how to use the built in functions. Did I miss something?
Thanks!
|
|
|
|
 |
API Support
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 14:06
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 16:52
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
|
|
|
 |
[quantisan]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 18:34
|
|
User rating: 1
Joined: Fri 26 Mar, 2010, 19:19 Posts: 116 Location: Canada
|
Use an IDE for JForex coding popup tips. Either Eclipse or Netbeans is good. They're professional IDE that are leaps and bounds better than any EasyLanguage or MQL editor.
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 19:05
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
quantisan wrote: Use an IDE for JForex coding popup tips. Either Eclipse or Netbeans is good. They're professional IDE that are leaps and bounds better than any EasyLanguage or MQL editor. Good idea I did not think about that. Quick question, looks like you know what is going on in JForex. When testing a strategy, why do I get way different values when using tick open/tick close prices versus cubic spline ? To my knowledge cubic spline is tick interpolation? The strategy is based on open bars trading only so the two testing methods should give more or less the same results? I'm a seasoned MT programmer, what makes JForex better?
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Tue 07 Dec, 2010, 19:26
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
I opened the file with Eclipse for Java, but I still don't get the coding tips.
For instance the following code:
if(period == Period.ONE_HOUR) { if (askbar.getVolume() == 0) return;
Don't get any coding tips.
Don't I have to copy the api in some folder or something ?
Sorry I don't know anything about java my programming knowledge is very limited.
|
|
|
|
 |
[quantisan]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 08 Dec, 2010, 00:35
|
|
User rating: 1
Joined: Fri 26 Mar, 2010, 19:19 Posts: 116 Location: Canada
|
Saidar, I'll leave Dukascopy support to answer your question regarding tick choices in backtesting. I think it's been discussed before in the forum, so perhaps you can find your answer.
Better is a personal opinion. One obvious difference is that MQL is easier to code strategies in. But the problem with easy is that it makes the sophisticated impossible. If you want easy, go with MQL. If you want robustness and versatility, go with JForex. The only way to know is to try both and form your own opinion as everybody has different needs.
For Eclipse, you need to assign the javadoc and source files to the JForex library in the build path.
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 08 Dec, 2010, 10:31
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
quantisan wrote: Saidar, I'll leave Dukascopy support to answer your question regarding tick choices in backtesting. I think it's been discussed before in the forum, so perhaps you can find your answer.
Better is a personal opinion. One obvious difference is that MQL is easier to code strategies in. But the problem with easy is that it makes the sophisticated impossible. If you want easy, go with MQL. If you want robustness and versatility, go with JForex. The only way to know is to try both and form your own opinion as everybody has different needs.
For Eclipse, you need to assign the javadoc and source files to the JForex library in the build path. I just wrote my first strategy, must say it was not that hard java is actually quite user friendly... But I'm still confused about the different bactesting methods, I still get way different results when testing the different models. Will send an email to support about this.
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 08 Dec, 2010, 12:23
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
I guess I cannot go wrong with tick tesing (no interpolation) so I'll use that from now on. Only problem is optimization is out it takes way too long to run thousands of iterations.
|
|
|
|
 |
API Support
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 08 Dec, 2010, 15:02
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 08 Dec, 2010, 15:35
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
Support wrote: Thanks. Something that I picked up, lets say the strategy has a constant take profit of 20 pips and a constnat stop loss of 10 pips. When NOT using the tick testing mode, the actual pips where the profit is taken or where the loss is taken varies greatly. It is seldom precisely the specified take profit or stop loss. Any idea why this is happening ? I know the code is run on every opening of a new bar or closing of a new bar, but the tester should recognize that the profit or loss should have been taken at the specified value and not the current one at the beginning of the new bar.
|
|
|
|
 |
API Support
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 15 Dec, 2010, 11:19
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Quote: When NOT using the tick testing mode, the actual pips where the profit is taken or where the loss is taken varies greatly.
When the Historical tester runs using bars price, then the historical tester assume tick which comes on bar close/open. That's why the take profit has different results.
|
|
|
|
 |
[Saidar]
|
Post subject: Re: Need some code examples |
Post rating: 0
|
Posted: Wed 15 Dec, 2010, 17:09
|
|
User rating: 0
Joined: Tue 07 Dec, 2010, 10:51 Posts: 39
|
Support wrote: Quote: When NOT using the tick testing mode, the actual pips where the profit is taken or where the loss is taken varies greatly.
When the Historical tester runs using bars price, then the historical tester assume tick which comes on bar close/open. That's why the take profit has different results. Yes I have figured that one out. Here is a tip for the developers at Dukascopy: Modify the tester to close the trade at the SPECIFIED takeprofit and stop loss. I know the tick will never be at that TP or SL but it won't use anymore processing power to anyways close the trade and that price. It is a very small modification I think. That way the tester will obviously give more accurate results. This feature is built in in metatrader and works very good.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|