Dukascopy
 
 
Wiki JStore Search Login

Close position(s) when they last longer than 1:30 hour
 Post subject: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Sun 11 Aug, 2013, 20:15 

User rating: 1
Joined: Mon 05 Aug, 2013, 22:37
Posts: 33
Location: SwitzerlandSwitzerland
To all brilliant minds out there,
I have multiple positions opened. And I want to close whenever a position lasts longer than 1 hour 30 minutes.
Enlightened me on this seemingly simple task please. :roll:
Thanks,
m


 
 Post subject: Re: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Mon 12 Aug, 2013, 08:14 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
Hello!

I hope this will help you to find a solution for your problem. Just modify the time in the respected block.


Attachments:
close_after_specific_time.vfs [26.52 KiB]
Downloaded 479 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: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Mon 12 Aug, 2013, 12:32 

User rating: 1
Joined: Mon 05 Aug, 2013, 22:37
Posts: 33
Location: SwitzerlandSwitzerland
Dirk, thanks again. I'll come back again with the next question in no time. :P
km


 
 Post subject: Re: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Mon 12 Aug, 2013, 12:34 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
Alright ;)


 
 Post subject: Re: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Mon 12 Aug, 2013, 21:19 

User rating: 1
Joined: Mon 05 Aug, 2013, 22:37
Posts: 33
Location: SwitzerlandSwitzerland
Hi Dirk,
I'm having JSON decoding error 4 when trying to implement your example. Other parts of strategy are compiled properly. This error happen at the Calculation Expression block. If I disconnect that block from the Position Viewer block, the strategy can be built without error. The same happened also after disconnecting any blocks below the Express block confirming that Calculation Expression block is where the error is. Is it my mistake or the current bug on JSON error?
Thanks,

Image


Attachments:
CaptureJSONerror.PNG [61.25 KiB]
Downloaded 823 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: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Tue 13 Aug, 2013, 08:42 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
I am very sorry, please use Calculation instead of Calculation Expression. It causes us still problems :(
Image
I hope it works then.


Attachments:
Calc.png [17.08 KiB]
Downloaded 909 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: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Tue 13 Aug, 2013, 20:18 

User rating: 1
Joined: Mon 05 Aug, 2013, 22:37
Posts: 33
Location: SwitzerlandSwitzerland
Hi Dirk,
Many thanks but sorry to come back to you again. I wanted to close positions that lasted longer than 59 minutes. But the resultTIME coming from this GetTimeUnit will never go beyond 58 minutes. So my positions are never closed by this.

I would expect the time, from resutlTime, to keep on increasing as time passes by. But I see numbers looping/jumping from 0 to 58 in every candle.
Image


I tried to check if the date and time are working as the numeric floating representation of dates are hard to understand. But Those parameters are not reflected correctly (1970 in candle time) or they don't appear at all (none in creation time).
Image

Thanks for all your patience with my inquisitive and (dump!) questions..
m


Attachments:
DataUnseen.PNG [37.2 KiB]
Downloaded 877 times
StillConfusedInTime.PNG [234.97 KiB]
Downloaded 871 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: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Wed 14 Aug, 2013, 08:22 
Visual JForex expert at Dukascopy
User avatar

User rating: 27
Joined: Fri 03 May, 2013, 18:25
Posts: 366
Location: GermanyGermany
Ok. Could you please provide us with the strategy so that i can have a look at it?

Thanks.


 
 Post subject: Re: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Wed 14 Aug, 2013, 18:25 

User rating: 1
Joined: Mon 05 Aug, 2013, 22:37
Posts: 33
Location: SwitzerlandSwitzerland
Hi Dirk,
I am quite reluctant to load my first messy blocks but here they come! :mrgreen:
Thanks,


Attachments:
MyFirstMessingWithMoney.vfs [47.82 KiB]
Downloaded 462 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: Close position(s) when they last longer than 1:30 hour Post rating: 0   New post Posted: Thu 15 Aug, 2013, 12:29 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
OK guys it will be hard to understand, but lets try.
Visual JF uses UNIX time stamp for date time variables.
Read this first:
https://en.wikipedia.org/wiki/Unix_time
So to get variable of 1.5 hour we have to calculate it in milliseconds:
1.5 * 60 * 60 * 1000 = 5400000
Then we add condition if difTime >= 5400000 then close.
Corrected strategy is in file attached.
download/file.php?mode=view&id=4278


Attachments:
MyFirstMessingWithMoneyv2.vfs [46.6 KiB]
Downloaded 622 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.
 

Jump to:  

  © 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