Dukascopy
 
 
Wiki JStore Search Login

Close a pending position when price hit target and the position was not filled
 Post subject: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 01:56 
User avatar

User rating: 0
Joined: Sat 04 May, 2013, 16:08
Posts: 17
Location: ItalyItaly
Hello everybody,

I am having an issue with the pending order block. I am tryin to tell the strategy to close the pending position, in case the price hits my target before the position was actually filled. I tried in many ways, but I can't figure out how to do it yet. Any help? Thank you very much
Attachment:
closePosition.PNG [51.15 KiB]
Downloaded 519 times


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 09:03 
User avatar

User rating: 6
Joined: Fri 12 Apr, 2013, 14:08
Posts: 88
Location: FranceFrance
Quote:
to close the pending position


You mean to cancel the pending order or to close the position created by the order?

Quote:
in case the price hits my target before the position was actually filled

I have to say I do not understand the logic. You want to set the order to be triggered at a certain price and than cancel the order between the triger and the filled? What is the point?

Please, attache your strategy by exporting it on you local computer and than attaching to your message the .vfs file.


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 09:07 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Greetings.

In the first IF block use More or Less flows instead of Equals.
Image

Best regards, support team.


Attachments:
closePosition.PNG [54.96 KiB]
Downloaded 863 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 a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 13:51 
User avatar

User rating: 0
Joined: Sat 04 May, 2013, 16:08
Posts: 17
Location: ItalyItaly
Sorry If I didn't explain well.

So let's say I have a pending short order, with stop and target as well.
Let's say the price level does not reach my order, so it is NOT triggered
the price moves down and reaches the level where is my target
Cancel the pending position

thanks..!


Attachments:
pin_bar_ver2.vfs [103.85 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.
 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 13:59 
User avatar

User rating: 0
Joined: Sat 04 May, 2013, 16:08
Posts: 17
Location: ItalyItaly
And actually I have another issue...
If the position is triggered, and the price moves to trigger the stop loss, then the strategy creates again the same order, with the same stop level and gets closed immeditaly..
No trades have to be done until next candle if the stop is triggered.


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 14:39 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Quote:
The price moves down and reaches the level where is my target

So it can be described with next condition:
If Bid <=(less) Target Then Cancel Pending.

To avoid creation of position on every tick use onCandle event insted of onTick.


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Tue 21 May, 2013, 16:31 
User avatar

User rating: 0
Joined: Sat 04 May, 2013, 16:08
Posts: 17
Location: ItalyItaly
About the multiple order creations, here's what happens:

The strategy looks at the beginning of a new candle, how was the previous candle.
If the previous candle meets certain requirements, a pending order is placed.
Maybe the order is filled, that's ok.
The price then goes to hit either the stop loss, or the target, before the actual candle is over.
Since the actual candle is not over, and now there are no open positions, the previous candle is still the one that meets our requirements, so another order is set.
that's what I don't want.
If my pending order is filled and price reaches stop or target within the next candle, then wait till actual candle is over before placing a new order.

This is only the issue about the multiple order opening, but I still have to fix the problem of canceling the pending position if price reaches target before triggering my order.


Nic


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Sat 15 Jun, 2013, 10:39 
User avatar

User rating: 0
Joined: Fri 14 Jun, 2013, 21:26
Posts: 35
Location: Italy, Turin
I need help here 2...


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Mon 17 Jun, 2013, 12:35 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Please provide an example of the strategy to speak substantively.


 
 Post subject: Re: Close a pending position when price hit target and the position was not filled Post rating: 0   New post Posted: Mon 21 Mar, 2016, 22:35 
User avatar

User rating: 0
Joined: Mon 21 Mar, 2016, 01:35
Posts: 1
Location: Portugal, Braga
Hi there :)

Where you guys are with this? Did you have success on finishing this strategy? And if yes can you share it please?

I'm looking for something similar, example:

Price is at 1.5000 I set a pending order for example a SELLSTOP at 1.4500 everything good until now. Now is when it comes the automated thing I need, IF the price goes UP before going to 1.4500 and reach 1.5500 this SELLSTOP pending order that didn't get filled will be deleted when the market price reaches this 1.5500 level.

Or it can be included where you open positions and have this option.

Side: SELLSTOP (I choose the type of the order from BUY, SELL, BUYLIMIT, SELLLIMIT, BUYSTOP, SELLSTOP )
Entry Price: 1.4500 (Here I will set the price that order will be opened)
Slippage: 10 (Example)
LotSize: 1.0 (here I choose the amount)
S.Loss: 1.4600 (Example)
T.Profit: 1.4300 (Example)
Delete Order: 1.5500 (And this is the level price at the order will be deleted, in the case that goes to this level "1.5500" first, instead of going to the 1.4500 level. Because if the price market goes to 1.5500 before it goes to 1.4500 I will not that the SELLSTOP order gets executed any more at 1.4500 and because I will not be all the time in front of the computer I want to do this automatically.)

Can someone help me with this please? I'm new with Visual Jforex, thank you.


 

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