Dukascopy
 
 
Wiki JStore Search Login

I want to cancel/close only a short trade and the rest not to be affected by this rule
 Post subject: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Fri 07 Aug, 2015, 12:05 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
Hi again :).
I have checked on this forum and so far i haven't found what i have been looking for. Here is my problem:
This strategy is just a sample and has two sell signals.
Let's put our attention on the first short block: in order to have a sell order SMA200> candle close and CCI 27 < -100. Ok so far so good. Now i want to close/cancel this trade when SMA200< candle close.

I want this rule to be applied only for the first short block and the second short block not to be affected at all by this rule.
I said that because the second short block is running only Sma200< candle close......but this trade will be automatically closed due to that rule which cancels/closes trades when SMA200<candle close.
I hope you understand
Thanks in advance


Attachments:
sample.vfs [31.43 KiB]
Downloaded 148 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Fri 07 Aug, 2015, 14:24 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi

One solution can be the one i place in annex...

Take a note that i have added a comment in both sell orders command. We can set the order label and use it i think, but more blocks are needed to set the label and comment is just there.
The block is only executed when are positions open and check for the comment of the order. If comment match, close the order... the other blocks don't are affected.

Not tested...

Regards

JL

Edit: i think i made a mistake on sma comparation... check if your condition is for '<' or '>'


Attachments:
sample1.vfs [43.03 KiB]
Downloaded 162 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Fri 07 Aug, 2015, 19:52 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
It doesn't work unfortunately. I made this strategy even simpler and lowered the amount from 10 to only 1 mil. I don't figure out where is the problem.


Attachments:
samplenew.vfs [40.79 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Fri 07 Aug, 2015, 20:38 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
hi...

That is very ambiguous... Can you explain what doesn't work ? What happened or not and is supposed to ? Have you monitored the variables ?

Regards

JL


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Sat 08 Aug, 2015, 08:51 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
Yap of course. After your modifications this strategy is acting as nothing has been changed. It takes sell order when sma200 > candle close and follows entirely the stop loss and take profit.........no way of closing/canceling the opened trade when sma200< candle close.


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Sat 08 Aug, 2015, 14:54 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi...

It seem's to be some problem with string comparison, the logical part is ok... Have you checked if "one.comment" on the if has any value when the order is filled ?
Drag this variable to the board and see it when running the strategy.

If i have some time i will try to test.

Regards

JL

Edit: I done a fast test and appears one of two "bugs"... The comment don't is set at order command, or the if can't get the comment as the 'one.comment' never show any value.
I can make a try with order label, but more logic is needed... Well, if i have time i will give a try.
Other possibility is in order amount... you add a unit to one of the order command in amount, and compare on the if i'm using for comment comparison. It's only a small change of variables.

Edit2: i have made the changes i said before using amount and it seems to work as one order was closed with 1 pip... see images with the changes needed...
Image
Image
Image


Attachments:
2015-08-08_1611.png [39.33 KiB]
Downloaded 413 times
2015-08-08_1610.png [43.63 KiB]
Downloaded 414 times
2015-08-08_1612.png [17.64 KiB]
Downloaded 442 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Sun 09 Aug, 2015, 14:25 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
If you don't mind please attach a VFS file because with Png file i can't open at all. It gives me an error message.


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Sun 09 Aug, 2015, 22:35 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
hi

here it goes.

Regards

JL


Attachments:
samplenew.vfs [39.75 KiB]
Downloaded 158 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 09:26 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
Negative.... The strategy runs as if nothing has been added to it. Strange. When the month ends the last trade is closed automatically .. that's why a position appears with less than 50 pips


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 10:26 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi

Yeap, you are right... i checked and also can't get the position amount. It's maybe a bug with getters and setters on positions... the only chance i get now is using a boolean variable if the order is of one type as all this logical ideias failed...


Lets see if Anime says something...

Regards

JL
Image


Attachments:
2015-08-10_1021.png [74.32 KiB]
Downloaded 394 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 12:12 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
let's hope Anime sees this. There must be a way of doing this and overcome this issue.


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 12:48 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi

I made a mistake on orders loop viewer... my apologies...

Test now this one with that error corrected.


Regards

JL

edit2: and another one using my original ideia. The "bug" was not in VJF but on my code... :/


Attachments:
samplenew (2).vfs [41.96 KiB]
Downloaded 157 times
samplenew (1).vfs [40.7 KiB]
Downloaded 174 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: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 13:19 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
no change :(.. unfortunately


 
 Post subject: Re: I want to cancel/close only a short trade and the rest not to be affected by this rule Post rating: 0   New post Posted: Mon 10 Aug, 2015, 13:23 
User avatar

User rating: 0
Joined: Wed 22 Feb, 2012, 12:24
Posts: 44
Location: Romania, Bucharest
finally it works. Thank you. You are good


 

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