Dukascopy
 
 
Wiki JStore Search Login

How to recognise position added as a last one?
 Post subject: How to recognise position added as a last one? Post rating: 0   New post Posted: Tue 16 Sep, 2014, 14:55 
User avatar

User rating: 0
Joined: Wed 16 Jul, 2014, 14:44
Posts: 21
Location: PolandPoland
Good morning,

i have gained some knowledge about using Visual Jforex to this day, but i've found a 'task' which i have troubles in getting through.

Let's say: Our strategy, in some circumstances, openes positions - we never know how many of positions may appear, number of positions in our strategy isn't fixed, or restricted in any way. There can be for example 3, just as well there can be 14 pending positions, or filled positions at the same time and there is no way of 'predicting' number of them.

And now, my problem:
how could i send some commands to NEWEST position only...?

If we would have, let's say, max 2 positions at a time, it would be very simple. We could just 'name' positions by using 'output value' in 'open at market' or 'pending order' block, and then compare 'create time' of those 2 positions in 'calculation' block, to see which creation time is bigger.

But if we don't know how many position they may be, how could we 'tell' the Visual Jforex, that we want to send commands >>only<< to position, that was added, or opened, or filled as last?

My little thoughts about possibilities of solving that:

1. making mechanism, which compares any creation time of all existing positions, and 'picking up' the largest value. Visual jforex has unix time, so bigger time value = later.
I'm not able to find blocks which can make it, i mean - function like 'compare all opening times and pick up biggest one'.

2. having somethins like 'get historical candle' - 'shift' function. If i place in 'get historical candle' block 'shift' 0 - it means 'newest candle', 'Shift' 1 - means previous, etc. I don't see something like that for positions.

3. making mechanism which is automatically naming positions with some numbers, like - first positions named 'position1', next one 'position2' etc - and than a mechanism, that somehow 'reads and understands' which position label has the greatest number value.

I'm not trying to say, that it is important to me to solve this problem at any particular way, i'm just showing up my thoughts. I just need any 'working answer' :)

I'm just wasting time now by being not able to work this at my own,
please write me a solution, i would be truly grateful,


Thank You in advance,
nine99


 
 Post subject: Re: How to recognise position added as a last one? Post rating: 0   New post Posted: Wed 17 Sep, 2014, 20:21 
User avatar

User rating: 0
Joined: Wed 16 Jul, 2014, 14:44
Posts: 21
Location: PolandPoland
Please, help me to solve this problem,
thank You.


 
 Post subject: Re: How to recognise position added as a last one? Post rating: 1   New post Posted: Thu 18 Sep, 2014, 14:13 
Visual JForex expert at Dukascopy
User avatar

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

Thanks for your post.
It is possible to identify your orders/ positions based on several criteria but the main question would be Why you need to identify them by sending time ??
Any open position or pending order can be monitored by several conditions (status / price / indicator levels / P&L / and much more...) using loop functions that performs real time checks, in our case it would be the Position Viewer block.
Limiting the positions number is not mandatory for a given strategy you can easily bypass such use.

Please describe in depth the way you want to manage your positions based on concrete example and we'll do our best to help you.

Thanks


 
 Post subject: Re: How to recognise position added as a last one? Post rating: 1   New post Posted: Fri 19 Sep, 2014, 13:33 
Visual JForex expert at Dukascopy
User avatar

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

Here is a genius example inspired by an idea of our dev team lead which initially developed a strategy to close half of the opened positions. Using a simple counter and a calculation block, the idea was to divide the available number of open positions by 2 and close this half (whatever the number of the opened positions)
I modified this in order to have a subtraction instead and an order identification based on its creation time. As a result for this example, any open position will be systematically closed except the first one. Up to you to enhance the closing conditions based on your criteria.

Cheers!


Attachments:
HalfPositionsDemo.vfs [28.68 KiB]
Downloaded 97 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:  

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