|
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.
SMA cross over |
Guest
|
Post subject: SMA cross over |
Post rating: 0
|
Posted: Wed 22 Dec, 2010, 19:34
|
|
User rating: -
|
 Hi, i am trying to design a strategy with a single moving average cross over, and a strategy with two moving averages crossing over each other. Can any one help me up with this please. Thanks in advance Best regards; jahzlone.
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Tue 04 Jan, 2011, 14:25
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
PhantomTrader
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 06 May, 2011, 18:54
|
|
User rating: 0
Joined: Wed 18 May, 2011, 16:45 Posts: 3 Location: United StatesUnited States
|
Hi Support team,
I don't know java but would like to modify this strategy a little bit.
I want to use EMA and SMA, instead of 2 SMAs.
Let's say EMA is 5 and SMA is 20. What should be changed?
|
|
|
|
 |
[trottel]
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Thu 12 May, 2011, 07:15
|
|
User rating: 0
Joined: Wed 27 Apr, 2011, 13:56 Posts: 18
|
I have created the strategy which uses 3 simple moving averages with 5, 8 and 13 periods. Like Alligator but without shift into the future. BUY or SELL order is submitted if MA5 crosses MA8 then MA5 crosses MA13 and finally MA8 crosses MA13. The BUY or SELL order is closed if the condition (MA5>MA8 and MA8>MA13) or (MA5<MA8 and MA8<MA13) is no more valid.
But if there is flat this strategy works not well because of too many fake signals. If you are able to filter them then it would bring solid profit. If you need the code I can post it.
|
|
|
|
 |
PhantomTrader
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 13 May, 2011, 17:20
|
|
User rating: 0
Joined: Wed 18 May, 2011, 16:45 Posts: 3 Location: United StatesUnited States
|
Hi Trottel,
Please post it.
thank you in advance.
|
|
|
|
 |
[trottel]
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 13 May, 2011, 18:18
|
|
User rating: 0
Joined: Wed 27 Apr, 2011, 13:56 Posts: 18
|
See attachment. FirstStrategy.java is entry point.
Attachments: |
3MAs_strategy.zip [7.12 KiB]
Downloaded 413 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.
|
|
|
|
|
 |
PhantomTrader
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 16 May, 2011, 18:42
|
|
User rating: 0
Joined: Wed 18 May, 2011, 16:45 Posts: 3 Location: United StatesUnited States
|
Hi Trottel,
Getting an error when trying to compile it. It says, it can't find jforexlib.jar.
By the way, are you programmer? Do you take requests to code strategies?
|
|
|
|
 |
[trottel]
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Tue 17 May, 2011, 09:11
|
|
User rating: 0
Joined: Wed 27 Apr, 2011, 13:56 Posts: 18
|
Yes, sorry, I forgotten to say that before compiling this indicator you should 1) export package jforex.lib.trend as JAR named as jforexlib.jar or as you prefer. 2) adjust the absolute path to the exported JAR in @Library annotation (at the top) in FirstStrategy.java I've attached this JAR to this message as ZIP. You only need to rename it to JAR. Quote: By the way, are you programmer? Yes. I am. Quote: Do you take requests to code strategies? No. Because I don't have big experience in forex. I search for own strategy at the moment.
Attachments: |
jforexlib.zip [11.45 KiB]
Downloaded 366 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.
|
|
|
|
|
 |
PhantomTrader
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Tue 17 May, 2011, 17:40
|
|
User rating: -
|
Hi Trottel,
Thank you.
I have couple strategies that I want to program but don't know how. If you help me, you can use them too.
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Thu 26 Jan, 2012, 23:26
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 27 Jan, 2012, 08:39
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
jozsi74 wrote: Could you tell me how to modify the program - https://www.dukascopy.com/wiki/#SMA_Crossover - if I want to use ticks? If by ticks you mean tick chart, then just change the "Period" to TICKS in the parameters dialog which appears just before strategy start.
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 27 Jan, 2012, 08:57
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
If I set Ticks as Period, then I am getting error message:
Strategy tester: com.dukascopy.charts.data.datacache.DataCacheException: getCandleStart() called with TICK period @ dukascopy.strategies.indicators.SMAStrategy.onTick(SMAStrategy.java:50)
With "normal" time periods it is working fine, only there is error message if I use ticks. How to solve it? And what if I want to use more ticks?
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 27 Jan, 2012, 14:13
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Fri 27 Jan, 2012, 18:01
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
But why there is not good if I choose tick as a period? In the dialog box 1 tick is the shortest period.
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 10:09
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 10:45
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
If I set Tick as Period in the dialog box at the start, then I get error message:
Strategy tester: com.dukascopy.charts.data.datacache.DataCacheException: getCandleStart() called with TICK period @ dukascopy.strategies.indicators.SMAStrategy.onTick(SMAStrategy.java:50)
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 13:33
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 13:51
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
Thanks. If I am right, then I have to use this:
sma
double[] sma(Instrument instrument, Period period, OfferSide side, IIndicators.AppliedPrice appliedPrice, int timePeriod, Filter filter, long from, long to) throws JFException
But how to setup "from" and "to" in the given strategy?
|
|
|
|
 |
API Support
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 14:05
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
There is an example (the last snippet) in the section of the previously given link. You can download it, test it, then adjust the snippet to use SMA indicator and then when you see how it works, integrate it into the SMA crossover strategy.
|
|
|
|
 |
jozsi74
|
Post subject: Re: SMA cross over |
Post rating: 0
|
Posted: Mon 30 Jan, 2012, 15:27
|
|
User rating: 0
Joined: Tue 11 Oct, 2011, 20:13 Posts: 64 Location: India,
|
I made it, it is working, but the problem the historical test is very slow compare when I am using longer time periods.
|
|
|
|
 |
|
Pages: [
1, 2
»
]
|
|
|
|
|