Dukascopy
 
 
Wiki JStore Search Login

How close postion after specific period
 Post subject: How close postion after specific period Post rating: 0   New post Posted: Sun 26 May, 2013, 11:42 
User avatar

User rating: 9
Joined: Sun 18 Dec, 2011, 03:31
Posts: 160
Location: Egypt, Cairo
i want to close each open position in my strategy after 3hour (Time Stop Loss),How ?


 
 Post subject: Re: How close postion after specific period Post rating: 0   New post Posted: Mon 27 May, 2013, 10:37 
User avatar

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

I have attached a code which will exit an open position after 10 minutes. There are many ways to do this - but this is quick and easy.
Tested - working ok!

The picture shows the time calc I use for 10min - the rest of the logic is in the attached file =)


Image

The setting for the calculation is SUM


Let me know if you have any questions?

DoC


Attachments:
timeexitcalc.jpg [83.34 KiB]
Downloaded 638 times
timeexit.vfs [39.71 KiB]
Downloaded 312 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: How close postion after specific period Post rating: 0   New post Posted: Mon 27 May, 2013, 11:18 
User avatar

User rating: 9
Joined: Sun 18 Dec, 2011, 03:31
Posts: 160
Location: Egypt, Cairo
doczero wrote:
Hello FXEgyptian!,

I have attached a code which will exit an open position after 10 minutes. There are many ways to do this - but this is quick and easy.
Tested - working ok!

The picture shows the time calc I use for 10min - the rest of the logic is in the attached file =)


Image

The setting for the calculation is SUM


Let me know if you have any questions?

DoC


thanks you for fast response but i don't to open position after each 10minute ,i want to close each position after 3 hour from it's opened


 
 Post subject: Re: How close postion after specific period Post rating: 0   New post Posted: Mon 27 May, 2013, 11:50 
User avatar

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

Sorry I built it with 10min as this would be easy to test in the historical tester with 1 min data. It was more for the example - I didnt notice you put 3hr above! lol Sorry about that.

So you could change the second parameter to: 10800000 (which is 3 hours in miliseconds).

The .vfx file shows all the steps to get this working for a moving average crossover system. Have a play with that and let me know if anything isnt clear.

Thanks,

DoC


 

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