Dukascopy
 
 
Wiki JStore Search Login

Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time
 Post subject: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Tue 27 Dec, 2016, 15:45 

User rating: 0
Joined: Sun 28 Sep, 2014, 19:04
Posts: 16
Location: GermanyGermany
Hello Everybody!

i try to find a logic how to close my all Pending Orders for the whole Day if one opened Order has hit TP. If not Then the Strategy should continue until a predefined Time. After this Time (for Example at 17:00) untill next Day at 8:00 the Strategy should paused or do nothing.
I have achieved this using the "Openedorder".state Block if closed but i should utilize the stop Strategy Block too which i don't want because then i have to restart it again manually.
I have thought to use the TradeEvent Start Point with Boolean Variables but I am bit confused.

I want to learn every function of each Block but Unfortunately There are not many Examples for every Case so i suppose i will need many Times the Help here in Forum

Thank you in Advance


 
 Post subject: Re: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 1   New post Posted: Tue 27 Dec, 2016, 17:00 
User avatar

User rating: 1
Joined: Wed 23 Nov, 2016, 05:50
Posts: 3
Location: Ukraine, Dnipro
You can add "Bulean variable "Can_trade" (for example) - if close with TP - set this variable to "False", before open order chek this variable, if it True - open position, if False do nothing. On next day reset this var to "True" again.

To close all orders I used position viewer - it iterate and close all positions after specific hour.


 
 Post subject: Re: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Tue 27 Dec, 2016, 18:18 

User rating: 0
Joined: Sun 28 Sep, 2014, 19:04
Posts: 16
Location: GermanyGermany
Hi, thank you for your Suggestion. I will try it to find the Way to connect it in one simple Strategy and see if it works


 
 Post subject: Re: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Wed 28 Dec, 2016, 14:39 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi,

There is another way to capture a position closed with TP or SL using Trade event using the P&L (either positive or negative) positive --> TP | Negative --> SL
This idea is valid assuming that your trades wouldn't be closed by any other way except SL / TP orders. This is the only "constraint" if we can consider it so.


 
 Post subject: Re: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Thu 29 Dec, 2016, 00:16 

User rating: 0
Joined: Sun 28 Sep, 2014, 19:04
Posts: 16
Location: GermanyGermany
Hi Amine,

I have tried it like you suggested in one Case where the LongPosition hits the TP and indeed the other Pending Order has closed cause P&L is > 0. But it opens new one Pend. Orders altgough my purpose is that the Strategy may stopped until the Next Day at specific Time.Would you tell me please what to do showing me a small sample?

Thanks a lot!


 
 Post subject: Re: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Thu 29 Dec, 2016, 11:14 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Have a look at this:

https://www.dukascopy.com/swiss/english ... +TP#p89649

or you can implement something like this but you should consider cases where slippage occurs

Image


Attachments:
SLposition.JPG [57.16 KiB]
Downloaded 398 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: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Thu 29 Dec, 2016, 13:52 

User rating: 0
Joined: Sun 28 Sep, 2014, 19:04
Posts: 16
Location: GermanyGermany
I have tried your Suggestion and i have read the other topic too and tried it with different alternatives but the Problem still remains. If the open Order hits TP,the other Pending Order get closed(very good untill here) but after that, since the next Candle is occured the strategy opens new Pending Orders and i don't want it to do so but instead of that the strategy should open new pending orders in the NEXT day at specific time for Instance at 8.

-here is one Alternative what i did based on your Suggestion:
Image


Attachments:
TradeEv.jpg [237.19 KiB]
Downloaded 412 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: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Thu 29 Dec, 2016, 16:32 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
I consider that the detection of the situation where an open position is closed by a TP is sorted out.
So we moved to another issue: Now you're trying to implement a time trigger once such position is closed; I've a quick example but I did not test it.. Please implement the part dealing with time trigger and order cancellation in your strategy and let me know the result.
I may need your strategy in vfs format to check any problem that may arise.
If you're concerned about privacy you can send it [email protected] and address the email to Amine

Thx


Attachments:
TradeAtTimeTrigger.vfs [35.15 KiB]
Downloaded 152 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: Only 1 Trade a Day if closed in TP,else the strategy continues until specific Time Post rating: 0   New post Posted: Fri 13 Jan, 2017, 19:50 

User rating: 0
Joined: Sun 28 Sep, 2014, 19:04
Posts: 16
Location: GermanyGermany
Hi Amine, i was busy thats why i didn't answered. I want to thank you for your exmple Sample. I have made some changes and it helped me to do what i wanted allthough i am very far from my final strategy but i have the mood to learn and i hope i will make it :) . I will come back with new Subjects. Have a nice Weekend.


 

Jump to:  

cron
  © 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