Dukascopy
 
 
Wiki JStore Search Login

Trouble creating my simple strategy in Visual JForex. Thank you.
 Post subject: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Tue 14 May, 2013, 15:42 

User rating: 0
Joined: Tue 14 May, 2013, 14:44
Posts: 3
Location: TaiwanTaiwan
Dear Support and Visual-JForex experts,

I don't have any programming experience and just started building my first simple scalping strategy. I think I'm done with most of it, but I can't figure out how to open a long/short position as soon as the price penetrates a Simple Moving Average.

My Strategy:
* Trade EUR/USD on 1-minute chart.
* Enter a trade only when Average True Range (time period: 4) is more than 0.0003
* As soon as the current price is more than 1 Pip above the 30-day SMA, open a long position.
* As soon as the current price is less than 1 Pip below the 30-day SMA, open a short position.
* Use 0.15 Lot for each order.
* Stop Loss = the ATR at the time I enter the long/short position.
* Take Profit = 80% of the ATR at the time I enter the long/short position.


Thank you very much for your help.


Regards,

Lee


Attachments:
File comment: What I have completed so far.
SMA_ATR_Scalping.vfs [29.21 KiB]
Downloaded 270 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.
 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Tue 14 May, 2013, 22:48 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
Hello Lee,

The system you have described is very difficult as you are working with 4 or 5 decimal places. I have found that running your described signal it doesnt trade alot as the ATR greater than 0.0003 rule is very strict - however see how you go. You will see I have made the values print in real time on the visual jforex screen to help knowing what each calculation returns.

I have tested and it is working but make sure you check it as im not happy with it and I am unsure if this is the best way to do the system.


Image


Attachments:
SMA_ATR_Scalping.vfs [40.48 KiB]
Downloaded 260 times
SMAATR.jpg [427.07 KiB]
Downloaded 521 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.
 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Tue 14 May, 2013, 22:55 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
lee67 wrote:
but I can't figure out how to open a long/short position as soon as the price penetrates a Simple Moving Average.



Hi Lee, I think this is the hard part because the system I have made above for you, will only buy when the price goes from being below the SMA to above the SMA , or visa versa for sell... Is this what you want?

If you want the system to just buy when price is above the SMA, or sell when below the SMA the code is attached. This trades more, however I dont know if it is a good way to go.


Attachments:
SMA_ATR_Scalpingnoprev.vfs [39.9 KiB]
Downloaded 266 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.
 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Wed 15 May, 2013, 21:51 

User rating: 0
Joined: Tue 14 May, 2013, 14:44
Posts: 3
Location: TaiwanTaiwan
Hi Mr.doczero,

Thank you so much for your help, I've learned a lot from your code.

"Hi Lee, I think this is the hard part because the system I have made above for you, will only buy when the price goes from being below the SMA to above the SMA , or visa versa for sell... Is this what you want?"

Yes, it's what I want. But like you said it's quite difficult to program & execute this precisely. After going over the tested chart, I noticed that some of entry orders were a bit too late; they were already several pips away from the 30-day SMA.

I'm working on various ways to modify/improve this strategy, hopefully I can come up with something useful.


Thanks Again,

Lee


 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Wed 15 May, 2013, 22:01 
User avatar

User rating: 7
Joined: Wed 04 Jul, 2012, 02:40
Posts: 109
Location: Australia, Melbourne
Hello Mr Lee.

I believe you will find the late enteries are caused by slippage or the spread (bid/ask). As you are dealing with a scalping style system (only small pips envolved) the system will be quite sensitive to this issue. Good luck and let me know if I can help more =)

DoCZero


 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Fri 17 May, 2013, 18:01 
User avatar

User rating: 0
Joined: Thu 16 May, 2013, 18:15
Posts: 4
Location: ItalyItaly
hello guys, hello doczero, are a beginner, someone help me to tell me which way should I start 'to understand something ...
then translate into Italian
greetings to all.


 
 Post subject: Re: Trouble creating my simple strategy in Visual JForex. Thank you. Post rating: 0   New post Posted: Mon 20 May, 2013, 09:28 
User avatar

User rating: 6
Joined: Fri 12 Apr, 2013, 14:08
Posts: 88
Location: FranceFrance
Hello Luca

you can start by watching the videos: https://www.dukascopy.com/swiss/french/f ... tutorials/

and https://www.youtube.com/watch?v=7cElEilgA1Q

Than open a NEW topic in this forum if you have any questions.


 

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