Dukascopy
 
 
Wiki JStore Search Login

Counting Positions
 Post subject: Counting Positions Post rating: 0   New post Posted: Sat 21 May, 2016, 21:53 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
Dears,

any idea how to count 'amount of opened positions' selectively for Short and Long side of the same market?
Please check part of the strat which should do the thing, but it is not working properly.

Appreciate your feed back,
Antony


Attachments:
File comment: this example is not working
CountingPositions.vfs [38.71 KiB]
Downloaded 93 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: Counting Positions Post rating: 0   New post Posted: Mon 23 May, 2016, 09:05 
Visual JForex expert at Dukascopy
User avatar

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

The way you implemented your idea is correct: Using position viewer and "Position is long" variable will help you to look for any open position and identify whether it is long or short.
But as far as understood this strategy is made to wok on real time run isn't ? Your initial goal is to let the strategy manage the TP entry ?


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Mon 23 May, 2016, 15:13 
Visual JForex expert at Dukascopy
User avatar

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

I get back to you as the way to implement your idea was not that simple:
Basically, we should implement a counter in a cycle that will count any open position per side. I do agree that the method is quite complex but I'm here to answer any question related to the way it is implemented.

Let me know your thoughts ...

Cheers


Attachments:
PositionsCountPerSideExample.vfs [27.05 KiB]
Downloaded 114 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: Counting Positions Post rating: 0   New post Posted: Mon 23 May, 2016, 15:19 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
Looks good, just need to compare Nb_short_positions versus Nb_long_position. Will try to implement and let you know. Appreciate your attention, Antony


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Tue 24 May, 2016, 22:16 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
Alright, sorting positions by Short / Long is working well. Thanks for that!
I am trying in the same way to implement sorting by inProfit / notInProfit, using 'PositionProfit in USD' but no success.

Thus the question is: am I on the right track?


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 10:05 
Visual JForex expert at Dukascopy
User avatar

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

Could you please send what you've made so far ?
Are you trying to count positions with positive P&L Vs begatives ones ? If so, then simply replace the variables of the IF block having "Position is Long" with P&L in USD (>0 and <0) that's it.

Cheers


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 11:37 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
Hi, I am using this block chain to Set TakeProfits to all open positions. It is based on what we have discussed previously. So variables Nb_Short/Long_Positions are taken from 'PositionCounter' as you suggested. And it is working well.

But, in case I want to add TakeProfit only to positions which are in profit (POS:_AllOpenPOsitions / DBL:ProfitLoss in USD), the "IF block" freely located in attachment is not helping.

Appreciate possible help :)


Attachments:
PositionsProfitYesNo.vfs [28.43 KiB]
Downloaded 101 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: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 13:39 
Visual JForex expert at Dukascopy
User avatar

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

I had a look into your file. The way the platform works is based on blocks connected to each other, if no link is made between them then the block in question will never be considered as a condition of your strategy. Also, the start point block should be linked as well.
As I said: you need to replace the IF block dealing with Long Short position with the one identifying positive / negative P&L

Cheers


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 13:45 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
Alright, just to clarify: the chain of blocks I attached is part of the whole strategy. The point is that even this chain works well when using Long/Short selection, it is not working when using the Profit/noProfit selection.


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 16:24 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Please send the whole strategy then and explain what is expected.
My understanding is that you want to count the number of positions in profit and the same for positions in lost isn't ??


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Wed 25 May, 2016, 17:25 

User rating: 0
Joined: Sun 15 Mar, 2015, 20:15
Posts: 77
Location: Czech RepublicCzech Republic
The difference is:
- previously I needed to count long versus short positions
- now I am not counting them but need to distinguish positions in profit

Thanks!


 
 Post subject: Re: Counting Positions Post rating: 0   New post Posted: Thu 26 May, 2016, 16:12 
Visual JForex expert at Dukascopy
User avatar

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

It sounds that you need more than that :)
I've added 4 additional counters for each of Long / Short having Profit / Loss results.
Let me explain how this work:
Why the strategy starts with these reset to 0 ?
Because if we do not assign the variables to 0, the counters will keep increasing endlessly and the result is indeed FALSE. So every tick, the strategy reset the counters to 0 then checks the positions sides and results. It is like the system redoing the job on every price and this is the way to update data on tick basis to get the latest result.
If you have any question regarding the logic, let me know.

Cheers


Attachments:
PositionsCountSide_PNL.vfs [31.88 KiB]
Downloaded 134 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