Dukascopy
 
 
Wiki JStore Search Login

BIDIRECTIONAL GRID STRATEGY
 Post subject: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Fri 12 Feb, 2016, 22:08 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hello
I'd like to automate this strategy with visual JForex, and wanted to know if someone could help me since I am the beginning and are still very inexperienced.
The strategy is this:

BIDIRECTIONAL GRID.
The system should instantly open two opposing positions, LONG-SHORT with tp 10 pips, and 60 pips stop loss. Should always instantly create a “veil” of pending orders (stop and limit type), for example say up to 5 levels above the current price, and 5 below the current price, one far from another 10 pips, (or simply create new opposite position long-short every 10 pip). And so, at each level, the same price (subject spreads, if it were possible to find a way to compensate for the spread to have the certainty that both orders of each level are opened) should always be open LONG-SHORT opposing orders tp 10 pips and 60 pips stop loss. Each time a level is activated, the system should create a new one at the top end of the grid and delete one of the lower end of the grid in the event of LONG movement. It should do the opposite in the case of SHORT movement. This is to make sure that between open positions and pending the price always remains trapped between 5 upper and 5 lower levels levels. Why this? In order to capture every price position even during sudden and large movements that can result from the news.
Clearly if the price goes into a trend, the trend in leadership positions will go to tp, the others will be in the negative. What to do? First of all what is written above should continue to be exactly that way. But, at this point, of each position that will reach -30 pips loss of the system will instantly open an extra position (in addition to the two LONG-SHORT of the primary grid), opposite to that in the loss of -30 pip and with a size increased compared to the first who is losing, we say x3 and tp 30 pips and this time also with a 60 pip sl. If after activating this order price ritracciasse and went in turn at a loss, on reaching the original price level, should open another pending opposite to the latter, this time with size x6, always with tp 30 pips and sl 60 etc ..., were to retrace several times, the system should follow this pattern: 0.1, 0.3, 0.6, 00.12, 00.24, etc., until finally not close the sequence, with a profit of 30 pips. But rather, as in the trading of Murphy's Law always exists, for example you may put a maximum of 4 retracements limit, beyond which the system will collect a loss. But in the meantime he will have gained something with the orders that have been reopened by the primary grid between level prices of the hedge range sequences.
Moreover, the system should not create another level of orders until both positions to a certain level price of the primary grid are not closed. With regard to the creation of new pending at those price levels, they should do only except those that are part of the hedge secondary grid in the hedge phase of the primary grid are not closed, but only positions for secondary grid.
As mentioned before If even then there was a way to offset the spread (which, although Dukascopy with some couples are really reduced however they exist) and avoid that perhaps only one of two opposing orders is triggered, unbalancing the grid, it would be wonderful.
Naturally sizes they should be very small, microlots.
Would be nice if an initial menu you could choose the distance in pips between the various levels, the value of the take profit and stop loss of the primary grid and the value of a possible gap between the long and short positions if you do not want that two orders are opened at the same price, also the distance of the stop loss and take profit of the secondary grid, the size of the start of the primary screen and the size of the value and the number of permitted hedging positions during the various price retracement.

I hope to be able to express myself well

Thank you all


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Mon 15 Feb, 2016, 09:42 
Visual JForex expert at Dukascopy
User avatar

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


Well, first of all, thanks for thr detailed description but did you try to build a first draft using VJF ?
I cannot build strategy on behalf od users from scratch as the idea is to let them do that by themselves.
I recommend you to summarize your specification in bullet points that includes the needed conditions / main sections and point out where exactly you faced any difficulties. This should includes the basic strategy information such as trading period etc..

Thanks


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Mon 15 Feb, 2016, 21:44 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
amine_chourou wrote:
Hi,


Well, first of all, thanks for thr detailed description but did you try to build a first draft using VJF ?
I cannot build strategy on behalf od users from scratch as the idea is to let them do that by themselves.
I recommend you to summarize your specification in bullet points that includes the needed conditions / main sections and point out where exactly you faced any difficulties. This should includes the basic strategy information such as trading period etc..

Thanks


Thanks for your answer.

My first blocks are below:

Image

I don't know if are correct.

Step by step...

First step:

I would like first thing the strategy start would create the system automatically two pending orders level (at the same price), buy stop and sell limit above market price and sell stop and buy limit below the market price, every level each 5 pips away from the price (but i don't know how to do), and take profit of 10 pips with stop loss 60 pip for every orders. On reaching the take profit would that automatically would open another buy/sell orders level at the same take profit price, and so on. Then every level of the grid will be a 10 pip range.
Trade size would use the Micro-: 1 euro cent / pip

I hope I have explained well

Can you check these first steps?

Thanks


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 16 Feb, 2016, 11:12 
Visual JForex expert at Dukascopy
User avatar

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

First thing first:
TO start there is an unkown parameter which you need to calculate: the entry price of your pending orders described in:
Quote:
"every level each 5 pips away from the price"

This is a calculation so you have to start with this, then comes at a second stage your entry orders as following:

Image

This is not clear enough for me:

Quote:
On reaching the take profit would that automatically would open another buy/sell orders level at the same take profit price, and so on. Then every level of the grid will be a 10 pip range.


What is reaching the take profit exactly and when ? Are you talking about pending order triggered then Market price hit the TP or pending order not triggered but market price went toward your TP ? and what should happens next ? : pending order cancelled if not hit, at which condition ? new pending order submitted if the previous becomes a market order ??


Attachments:
Step1.jpg [296.41 KiB]
Downloaded 1131 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: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 16 Feb, 2016, 21:52 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hello,

I try to answer your questions:


solution 1
When the strategy starts, the system detects the current price of that moment. Automatically creates a double-pending order (buy stop and sell limit) 5 pips above the current price, (both at the same trigger price), each with tp 10 sl 60 pips. Simultaneously does the same thing below the current price: 5 pips below creates a double pending order (sell stop and buy limit), both with tp 10 pips and 60 pips sl as before.
Every 10 pip the system will create layers of double orders as described above (I thought 5 levels above the current price levels and 5 below, as per the original text at the beginning of the discussion), which will be activated upon reaching a take profit. Or, alternatively, when you activate one of the two orders to distant levels 5 pips from the current price at the beginning of the strategy, just after a little will be achieved one of the take profit, it will collect the first profit of 10 pips and automatically, at the same price will take profit are to open two opposite positions, long and short, always with tp 10 pips and 60 pips sl.

solution 2
When it begins the strategy, the system instead of creating pending orders 5 pips above and below the current price, simply open immediately two opposing positions, long and short with tp 10 pip and 60 pip sl, and the achievement of each other tp opens again two opposing positions, long and short at the same price of the take profit.

Of course every pending order (or open position), will have the same trade amount: 1 euro cent / pip.

I ask you, what is best to do: whether to use pending orders, or make sure that the automatic system open positions directly.
But keep in mind that I'd like the system to create a new double-pending order long-short when both tp of previous locations start from that price level were achieved. EA should not create new orders or positions if one is still active. This will only happen in the next step, when EA activate the secondary grid for retrieving losing positions of -30 pips (see the beginning text). But we'll talk later.

The important thing is this: there are no oscillators or other indicators. This strategy is based solely on orders following the price movement. The aim is to follow the price in a non-directional.

I attach a drawing, and I hope to be able to explain everything.
In the meantime I will try to reproduce the blocks that you showed me.

Thanks for your help and cooperation.

Image


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Thu 18 Feb, 2016, 17:33 
Visual JForex expert at Dukascopy
User avatar

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

Thanks for the thorough specifications.
I've made an enhanced example for you that performs the following:
- When the strategy starts, it will submit 4 pending orders, 2 above the market price and 2 below. the range is 10pips with regards to the market price and this can be easily changed afterwards (variable name "Distance in pips from market").
- Once one of the 2 set of orders is triggered the other get cancelled and a new set of 4 orders is submitted 10 pips up&down from the market price.

I invite you to test this strategy carefully and let me know your feedback and if you're okay with these 2 sets of 2 orders (4 in total) you can improve it by adding the extra levels as per your description.

Thanks


Attachments:
Biderectional_V2.vfs [45.56 KiB]
Downloaded 315 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: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Fri 19 Feb, 2016, 01:14 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hello!
Good job!
I tested this part of the strategy and I really like how it works! Thank you, Amine, you have been very kind! Unfortunately I am not a expert programmer... indeed i am not just! I would like to learn good JForex visual but there are no manuals and information are few, but thanks to the good programmers like you of support, us newbies we get to the results! I'm going to look at the code that you programmed and try to reproduce it for other strategies. Thank you!
It 's almost exactly what I had in my head, although I noticed the historical beck-test that when is activated one of the long-short levels, before they create others need a bit' of time, is not istataneo, meanwhile the price moved and thus subsequent orders will not open exactly at the same price of the take profit orders previously opened. This determines a greater number of open positions simultaneously.
However, for the moment, if you agree I would change anything about this first part (primary grid), trying to see how it works in conjunction with the second part (secondary grid). So let us consider the first completed step, namely the primary grid, with long and short orders is ttivano every 10 pips. The primary grid must continue to work exactly as well even during the execution of the secondary grid, if this is activated. So now it would be necessary to program the secondary grid. At the moment primary grid is unbalanced: 10 pip profit against 60 pip loss are not a good risk-reward. In fact a stop loss so large compared to the take profit I had thought of the existence of the secondary grid.
I place scheme of what I'd like that the strategy would to do in addition to what it already does.

Image


I hope I have represented everything correctly and i have expressed myself well, so that you can understand more easily.
I ask you kindly to reduce the base size of the trade of primary grid. I noticed that every pip correspond almost 10 euro cents. I would like 1 cent per pip. When I tried to reduce the value of the initial menu, from 0.001 to 0.0001, then system do not open any more trade ... We must reduce because there is also a martingale, and you consider that my real account budget (when I'll use it) It will be only 500 €.

Thank you again so much for everything, I wait for your answer.

Hello!


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 23 Feb, 2016, 14:22 
Visual JForex expert at Dukascopy
User avatar

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

Here is my final draft for you. At this stage you have to test and modify your strategy on your own as I cannot do more than that.
One detail should be highlighted: the minimum traded amount cannot be less than 1000 whatever the currency pair is.

If you need a typical martin gale example, you can find it in this forum, if not let me know I'll attach one.

Thanks and enjoy your trading !

Cheers


Attachments:
Biderectional_V6.vfs [58.61 KiB]
Downloaded 307 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: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Wed 24 Feb, 2016, 23:39 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Greetings!

Thank you so much for your work. You have been very kind and I appreciate it.
I tested the strategy and looks quite profitable, but I had to change the ranges in this way: 100 pip tp, 600 pip stop loss. to recoup losses Orders: 300 pip tp 600 pip sl, going to change the blocks:

Image

These changes are enough or I have to change something? Because the tests sometimes I have the impression that not all the open positions that should ... But maybe it's just my impression.
I would be curious to understand which is the instruction that serves to open the first order of Martingale to the level of pre-loss (-30, -300, or any other value), and also that relative the change of the location of take profit of position in loss (10 to 30, according to the preceding description; or 100 to 300 in my actual version, etc ..) in order to modify these data at will, depending on the need.

Increase the range of the strategy makes it slower, but better than nothing. With the range that I had studied originally it open thousands of positions and I think they are mainly commissions for the broker going to burn the balance. I'll try anyway perform other tests with different configurations and see what I will happen, then if you can give me a hand to find and identify the variables and the blocks needed to do this.

If you want to show me an example of Martingale, it's interesting to me, of course. But in this regard there are things on the martingale set in the strategy that I can not understand. The martingale sequence that I thought (as per previous post), was: 0.001 (the basic size of the primary grid that you told me that you can not zoom out), then 0,003-0,006-0,012-0,024- and "stop" as an end sequence, if the very things go wrong, accepting the loss, not too overload positions. But from the reports of the various historical tester that I ran, I appear positions with size: 0.002 or 0.004; 0,008, etc. (I place an image below). Only in a few cases it appears 0.003 ... can you explain why?

Image


I thank you also for having inserted in .VFS file notes to explain the functionality of the block group. I do not quite find where the "variable" to say the strategy: 0,001-0,003-0,006-0,012-0,024. I noticed the "lossrank" variable but do not know if it's that, and also may contain a single numerical value, which is now set to "0".
For example:

Image

I would like for example, according to requirements, have the possibility to implement the number of martingale of the secondary grid step, and then after the last of 0,024, also add: 0,048-0,096-0,192-0,384. Can you tell which variable I have to change, add or block to do this? And if you'd wanted to change the values? For example, not what I said but others, to adapt better to the market phase, and the equity of the account if, for example, my start size is no longer 0,001 but 0,005 because my account has grown? (i hope :lol: )

Also, I can run the strategy on multiple currency pairs simultaneously? Because in "defaultinstrument" variable does not allow me to add others: only one or another.

Image

My dream would be to have an initial menu on startup of the strategy where you can set all the parameters, those that already exist more than others, such as the selection of the pair on which to activate the strategy and the selection with a check of how many and which recovery step losses must be sought through the strategy during the work session and a number of other parameters. The following image is an example of what I say:

Image

I also wonder if it is possible with Visual JForex to offset the spread to be sure that each position is opened and closed in conjunction with others, according to the strategy ...?

Thanks again for everything

I wait for your answer

Bye!


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Fri 26 Feb, 2016, 16:26 
Visual JForex expert at Dukascopy
User avatar

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

Regarding the position increase following Martin Gale pattern, I did it this way:
I created the dynamic "position size" variable which increments according to the previous position loss:
If previous position is closed with loss then I capture the position amount and double it or triple it. When doubling and when tripling? I introduced the counter to handle this and to identify what rank the loss has: The counter increments by 1 (+1) every time a loss occurred. So if position 1 is closed with loss then the counter value changes from 0 to 1 i.e. loss rank =1. If a second position is closed with a loss, then loss rank will be equal to 2 and so forth. Starting from Rank 2 the position size will be doubled where it is tripled only if the loss rank is equal to 1. Why using such counter ? because the logic of the situation has 3 levels: Level one where there is no position closed with loss / level 2 where the first position is closed with loss and level 3 for any positions closed after the first one with loss. If I would only have logic with 2 levels, I wouldn’t use a counter (that actually can handle logic levels with 3 and more) but another type of variable that could take only 2 values “True” and “False”. IF situation A happen then Variable is set to True and IF B happen the Variable will take value B. Bear in mind that the variable should has a start value (either true or false). If you understand this, you’ll be able to program anything you want.

It appears afterwards according to the test results that in some cases, you can have a loss ranked 2nd, 3rd, or 4th or even 100 that occur on a position having a traded amount of 0.001 thus it will be doubled instead of tripled and the chain continue 0.002*2=0.004 etc ..
To avoid this, I suggest to remove the counter logic and simply get a check on the position amount (position with loss in question) if it is =0.001 , then triple it and If greater than 0.001 double it. And once the upper limit of 0.024 reached the next position size stays there. Afterwards, it is up to you to insert another level of position change.

Instrument selection: This is possible but not by adding a tick boxes with instruments to be traded but with duplicating the strategy file instead. You’ll have 3 strategies each one running on a given pair. For testing purpose, you can do it in Jforex : W In historical tester tab click on “Instruments” button and activate the needed instruments.

Global variables display: This is an option in VJF that offers the display of settings and variable editing in the parameters window just like the way you displayed in your last screenshot. The variable attributes needs to be modified accordingly: right click on a custom variable and select edit then tick the box “Global variable” it will be displayed in the last runtime parameter’s window.

Cheers


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Sun 28 Feb, 2016, 18:15 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hello!
Thank you for the explanation. Now the logic you used to program me is clearer,
but the problem is that I can not associate the concept of counter that you have expressed
to the blocks you have created in JForex visual. At first time I tried to change the value of the
variable "position size", from 0.001 to 0.003 of the "calculation" block that shows as "second parameter": 2.
This is because I tried to interpret that "2" intends to double ( in the twin block is 3, I interpreted as the tripling),
so I tried to tell the program to start as of 0.003 is starting to get the sequence that I want for my strategy, 0.003-0.006-0.012 etc. etc.
instead of 0.002-0.004. But then it did not work, because every time the result of the beck-test takes me only more than 0.003 on the size
of the losses recovery orders.

Image

Honestly for the changes that I told you earlier I would not know how to do,
I miss the basics of Java programming and also the visual JForex functioning.
In the side menu, I see a lot of variables but do not know how to use them and
what they mean. If it comes to changing the numerical value of the take profit, stop loss,
or the distance from the market, do it, but the rest is too complicated.
I think I understand that the variables you can customize the time, is that correct?
And associate an axis of values ​​and specific functions, but then I do not know how
to connect it all, what are the basic concepts of this.

Else:
If i don't understand bad whether, orders that start with
size increased position for the recovery of losses, opens
only after the previous order went into stop loss, when it came
to -600 pip loss in my current version (at first it was -60 pips).
In fact, from what I see from the beck-test, I do not see orders
that open in the middle of loss, namely the achievement of a loss
of -300 pips price (but that is not yet in a stop loss of -600 pips).

Image

In the example that I report, the buy order which is
then went into stop loss (-600 pips) opened at about 1.19.
Sliding the report, the increased orders that are open I have
not found anyone that has opened at a price of about 1.16 or -300 pips from the opening price.
In my initial idea instead the concept was that the order of the secondary
grid protection is to be opened in half of the loss.
So if the stop loss is set at -600 pips when the price reaches -300 pips
should open an order with increased size in the opposite direction
to the order that is at a loss, according to this scheme:

Image

This is very important, because it tends to capture the
price while it is in the direction of loss but still has not lost.
And the eventual achievement of one of the stop loss, for the same
price will find the take profit of other orders that in addition
to covering the loss will yield even profit; Moreover, between stop loss
and take profit, to close the whole sequence of orders that will always remain open until then.
And all this must occur in order for each positions are in loss way. only after each
hedging order has been struck and activated, the system will create a next order
of 300 pips coverage distance, and when the sequence ends, the next pending order
not active has to be deleted from the system.
For example, if it closes the sequence order size 0.003, the pending order 0.006 should be discarded.
If you are in the step size of 0.006 and this will close, the next pending order
of size 0.012 will have to be eliminated from the system, and so on.
As already said, the whole procedure will be activated for every order
of primary grid which will be loss in the manner described.
Another very important thing is that activation of the first blanket order,
the order in loss of the primary grid will move its take profit of 100 pips 300 pips,
to adapt to secondary grid and go to correspond with the stop-loss of hedging order.
And the sequence should be this: 0.001 (starting size) -0.003-0.006-0.012-0.024-STOP.
If necessary, then add additional phases that go beyond 0.024.

I think this strategy should work well and be quite profitable, overcoming certain
stages of the market which, if they occur, may lead to the extinction
of the account with the current version.
If you feel up to edit this way I'm grateful. Of course if you like and see which works
you can also use you. Otherwise, if you can not do thank you very much the same for the work you have done until now.
I unfortunately i do not to do this if you don't followed step by step,
and I have no visual examples and explanations of visual JForex capabilities, I have great difficulties.

I hope to be able to explain all right.
I am Italian, and even the language is a further difficulty.

Thank you

I await your response

Greetings


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 01 Mar, 2016, 11:01 
Visual JForex expert at Dukascopy
User avatar

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

Thanks for your effort in writing a comprehensive and detailed specification. It is indeed clear but there is certain aspects that needs to be highlighted:
First, your idea is quite complex to start developing strategies and working with Visual Jforex. It is not complex at the level of tool itself but more for you to start learning VJF. If you are motivated to work with VJF and invest time and effort to enhance your skills I can help you but this is not the best example for a beginner as it implements several aspects of complex strategy development including logical triggers, counters, working with data array and many more.
It is essential that you reduce your requirements in order to understand and put down you need "in terms of blocks".
There is one major constraint in your idea: the number of open positions" either the ones originally triggered by pending orders or the loss recovery market trades. These open positions should be monitored individually and once one reached the loss recovery level it has to be compensated by a market trade that needs also to be stored within the array. at the end, this is very consuming in terms of performance and the result in my opinion cannot be that efficient (even though profitable) .
It is important that you introduce position limitation condition that will help you to monitor every trade and fine tune the strategy afterwards.
The main issue faced for me is how to identify a given trade that reached the loss level AND has been already "covered" with a loss recovery trade. You need to imagine hundreds of market orders each one with its open P&L and the ones covered (and indeed still open) has to be eliminated from the array. It is not impossible but I believe that you can simplify the main idea to reduce the turnover and increase the profitability.

I've included my last version of your strategy with some comments in addition to a MartinGale example. This example implements position limitation concept that you can easily identify in the IF blocks (Position amount < 1 or 0 ...) note that position amount variable stands for the number of open position here (and not the position traded amount as you can expect; confusing? Yes I agree :) )
Indeed, feel free to raise any specific question related to any block use, condition or workflow but in case you think that this is not for you, the best idea is to request the help of an external programmer.

Cheers


Attachments:
Biderectional_V2_1.vfs [60.16 KiB]
Downloaded 284 times
MartinGale.vfs [55.39 KiB]
Downloaded 290 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: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Thu 03 Mar, 2016, 00:03 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hi, Amine
First of all thank you for the work you've done for me! And the notations you entered in the file .Vfs.

YOU
"First, your idea is quite complex to start developing strategies and working with Visual JForex. It is not complex at the level of tool itself but more for you to start learning VJF. If you are motivated to work with VJF and invest time and effort to Enhance Your skills I can help you but this is not the best example for a beginner as it implements several aspects of complex strategy development including logical triggers, counters, working with data arrays and many more.
It is essential That You reduce your requirements in order to understand and put down you need "in terms of blocks" "

I
Clearly I want learn, however, i want realizing this strategy too, in which I have confidence. It is not new, a regular grid and a sequanza recovery of the positions at a loss which, taken individually, can be found on the internet. Perhaps the novelty lies in the fact that one turns into the other.
I realize that this strategy is not easy for me to learn to programming level, but I assure you that (if you want and you can) even if the pure programming work is for you, giving me an explanation, gradually i can learn. Also because I have in my head other strategies, much simpler, on which I want to ask your advice subsequently.

YOU
"There is one major constraint in your mind: the number of open positions" either the ones originally triggered by pending orders or the loss recovery market trades. "

I
When you say that you're referring also to the maximum number of open positions that you may have in Dukascopy? (100 if I remember correctly)

YOU
"These open positions Should be monitored individually and one ounce Reached the loss recovery level it has to be compensated by a market trade Also That needs to be stored Within the array. At the end, this is very consuming in terms of performance and the result in my opinion can not be That efficient (even though profitable). "

I
What exactly do you mean when you say that the result can not be so efficient? Which will be profitable, but not so much? Or simply that goes to overload too the computing power of the computer causing possible errors and / or interruptions? Or what else?

YOU
"It is important That You introduces position limitation condition That will help you to monitor every trade and fine tune the strategy afterwards."

I
I thought, in this regard, for the secondary recovery of the grid positions that no more pending orders as the primary grid, but to open positions directly to the market and to base them directly on the opening price, and go to add or subtract from the the opening price of 300 pips depending loss level when you have to open a long or short position.
Otherwise explain better what do you mean exactly by "position limitation condition" (I'm going to examine what good example of Martingale you provided to me).

YOU
"The main issue faced for me is how to identify a given trade That Reached the loss level AND Has Been already" covered "with a loss trade recovery. You need to imagine Hundreds of market orders each one with its open P & L and the ones covered (and indeed still open) has to be eliminated from the array. It is not impossible but I believe That you can simplify the main idea to reduce the turnover and Increase the profitability. "

I
If you think the idea is good, as I said before, for the secondary grid I thought to use market orders in this way (while you look at the chart that I posted last time):
1) Suppose that one of the positions that goes into a loss is long, for example with the open price of 1.0800 (EUR / USD). The system stores the opening price of the position (as well as all open positions, long or short, generated from the primary grid).
2) Depending on the level set loss (-300 pips), the system calculates that the open price of that position will subtract 300 pips, being that if the price will drop to 1.05, will automatically open a type short market position (so no pending order)
3) The price reaches 1.05, the system checks the previous position, 300 pips above, then the price of 1.08 (in this case makes the sum of the pips to arrives to the open position at that price), it checks the size = 0.001 and then modify the take profit from 100 to 300 (sl 600 already set) of the original long position and, based on the size value (0.001), through its counter opens this new short position with 0.003 size, tp 300 and 600 sl.
4) At this point the system detects the opening price of this short, in this case calculate 1.05 + 300 pips = 1.08. The system knows that if the price retrace to 1.08, in addition to long 0.001 will open another long market order with 0.006 size, and so on, each time by performing the same calculations. So, in this case: long 0.001 (with take profit changed from 100 to 300), short 0.003, 0.006 long, short 0.012, long 0.024. After the opening of the latter at a price of 1.08, if price still ritracciasse (bad luck!) until 1.05 at the price, through its internal counters, system will assess that will not open most any position, leaving to run the price eventually until the stop loss.
5) If the same price level, for example always 1.08, should be more than one already open position, suppose a long 0.001 and a short 0.003 and the price falls, the short 1.05 gather his profit while for long will as described above. If to 1.08 should be two open long positions, for example long long 0.006 and 0.001, at 1.05 through its counter pip and size, the system will already know who will open a short with size 0.003 and another short with size 0.012, and so on (we'll see if there will be risk of margin-call ...). According to the strategy, all take profit and stop loss will match same prices, and when the graph will stop retrace, you should make profit
Clearly this all you need to be on the reverse if the original starting position, the primary screen is a short instead of a long.
According to me this way all positions can be processed individually, and the system should treat as finalities to themselves ...
Do you think that my reasoning is correct? Do you think this idea is feasible in programming?

YOU
"I've included my last version of your strategy with some comments in addition pcs to a Martingale example. This example implements position limitation concept That you can easily identify in the IF blocks (Position amount <1 or 0 ...) notes That position variable amount stands for the number of open positions here (and not the positions traded amount as you can expect, confusing? Yes I agree :))
Indeed, feel free to raise any specific question related to block any use, condition or workflow but in case you think That this is not for you, the best idea is to request the help of an external programmer. "

I
I tested your last version but I can not understand how it works. From reports, apparently only it opens 0.001 positions and not those of recouping the losses. No with 0.003, 0.006, and so on.
Based on your previous version, I've connected the blocks that have not connected (but, if I understand it, you need to enter in the middle of a part that is used to control the number of positions, right?), Like this:

Image

But nothing has changed in the results ...
I also noticed the take profit of 30 pips set in these blocks (the ones not connected section):

Image

As the recovery blocks of losses I have tried to set 300 pips but nothing has changed ...
If you can explain to me, thank you.
Regarding the example of Martingale I thank you for sending it to me. Honestly I still have difficulty to associate your explanations to the blocks I see in VJF. But I understand what you say about the number of open positions and not on the amount invested ;-)
Do you think you can use the blocks of this martingale for the grill?

About this:

Image

I understood better how to load variables in the blocks, thanks.

I hope to be able to express myself well. I will go on to analyze the blocks of the example of Martingale, meanwhile, about everything else, wait for your answer.

Thank you! Greetings


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Mon 14 Mar, 2016, 17:50 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
.... ;-(


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 15 Mar, 2016, 13:09 
Visual JForex expert at Dukascopy
User avatar

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

Quote:
When you say that you're referring also to the maximum number of open positions that you may have in Dukascopy? (100 if I remember correctly)

No, I'm pointing on the huge amount of orders and positions submitted by the strategy, which is at our level not a problem, but could be an issue for you to monitor all the positions and orders. But indeed it is 100% up to you to decide.
Quote:
(I'm going to examine what good example of Martingale you provided to me)

Did you managed to analyze this ? did you noticed that the strategy implements the same logic but with reasonable number of open positions at a time ?
By the way I left this post unanswered to give you the needed time to analyze this example ...

Quote:
What exactly do you mean when you say that the result can not be so efficient? Which will be profitable, but not so much? Or simply that goes to overload too the computing power of the computer causing possible errors and / or interruptions? Or what else?


I simply meant what I suggested above: Less requirement for better strategy understanding at the level of VJF
Errors and overloads are things that you should look at but at a second level: Once the strategy is develpoed and you're happy with its results, you can start concretely the testing phase in Jforex platform and check if these technical aspects.
I'll leave profitability analyzes for you..

Quote:
If you think the idea is good, as I said before, for the secondary grid I thought to use market orders in this way (while you look at the chart that I posted last time):
1) Suppose that one of the positions that goes into a loss is long, for example with the open price of 1.0800 (EUR / USD). The system stores the opening price of the position (as well as all open positions, long or short, generated from the primary grid).
2) Depending on the level set loss (-300 pips), the system calculates that the open price of that position will subtract 300 pips, being that if the price will drop to 1.05, will automatically open a type short market position (so no pending order)
3) The price reaches 1.05, the system checks the previous position, 300 pips above, then the price of 1.08 (in this case makes the sum of the pips to arrives to the open position at that price), it checks the size = 0.001 and then modify the take profit from 100 to 300 (sl 600 already set) of the original long position and, based on the size value (0.001), through its counter opens this new short position with 0.003 size, tp 300 and 600 sl.
4) At this point the system detects the opening price of this short, in this case calculate 1.05 + 300 pips = 1.08. The system knows that if the price retrace to 1.08, in addition to long 0.001 will open another long market order with 0.006 size, and so on, each time by performing the same calculations. So, in this case: long 0.001 (with take profit changed from 100 to 300), short 0.003, 0.006 long, short 0.012, long 0.024. After the opening of the latter at a price of 1.08, if price still ritracciasse (bad luck!) until 1.05 at the price, through its internal counters, system will assess that will not open most any position, leaving to run the price eventually until the stop loss.
5) If the same price level, for example always 1.08, should be more than one already open position, suppose a long 0.001 and a short 0.003 and the price falls, the short 1.05 gather his profit while for long will as described above. If to 1.08 should be two open long positions, for example long long 0.006 and 0.001, at 1.05 through its counter pip and size, the system will already know who will open a short with size 0.003 and another short with size 0.012, and so on (we'll see if there will be risk of margin-call ...). According to the strategy, all take profit and stop loss will match same prices, and when the graph will stop retrace, you should make profit
Clearly this all you need to be on the reverse if the original starting position, the primary screen is a short instead of a long.
According to me this way all positions can be processed individually, and the system should treat as finalities to themselves ...


Did you managed to implement this ?
To make things clearer: I helped you as much I can, now the ball is at your side :)

Quote:
also noticed the take profit of 30 pips set in these blocks (the ones not connected section):


Well, it is very easy to change this !
Generally speaking, when we test, we modify some parameters and variables to maximize chances of executions and see how the strategy behaves.
The example posted in my previous message was far from being a ready-made strategy as I don't do that; This is a brainstorming according to your specification, and the final version should come from you.

Quote:
Regarding the example of Martingale I thank you for sending it to me. Honestly I still have difficulty to associate your explanations to the blocks I see in VJF. But I understand what you say about the number of open positions and not on the amount invested ;-)
Do you think you can use the blocks of this martingale for the grill?


You're welcome, I really hope that you studied it in order to understand the logic implemented. You could use some aspects in your strategy as well.

Cheers


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Thu 07 Apr, 2016, 20:57 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hi Amine, I reply you in private chat.

I wait..


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Wed 20 Apr, 2016, 13:29 
Visual JForex expert at Dukascopy
User avatar

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

Well, I get back to your strategy and implemented the following changes:
- To catch any position loss of any position having been closed, we must use the trade event start point as it is the only "gate" that allows the access to any information related to closed positions, in our case we used the P&L, the position size. So this is the reason why you can see that the recovery process is made out of the trade event start point.
- Any change of the logic of what you're calling "Grid" whether it is 1st, 2nd or any additional level of trade loss compensation needs to be implemented at the level of "TradeEvent" start point
- The Ontick side remained as it is so no changes are made for the blocks linked to that side.

I made a quick test to check the result and it looks good:
Image

Note that I changed the SL and TP for testing reasons (to speed up positions closure) so feel free to change your settings as per your needs
PS: I did not forgot your last message but as I said, I do not interact with users with the community chat. :)
Cheers


Attachments:
DataAnalyses.JPG [232.19 KiB]
Downloaded 915 times
Biderectional_V34.vfs [57.61 KiB]
Downloaded 244 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: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Mon 25 Apr, 2016, 11:00 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hi, Amine!

Thank you for your response and the work! You've been very kind! I I have to come and see you in Geneva ;-)
So, these days I've been testing the new version. It works better than before, we are creating a beautiful product, obviously you can also use you and everyone in the forum that deem appropriate to their needs.
However, there are still weaknesses in some phases of the market.
We go step by step:

1) it would be possible to create a default variable for setting the take profit of recovery orders of the loss as with all the other settings? So it appears also that the initial menu, and I'm not forced to make the change directly from the program blocks?

2) if I understand it, as you have been anticipating you, I saw from the tests that the recovery position is opened after closing at a loss the previous position. But it would be really important that the recovery position is opened to the loss level set in "LossLevelSecondGridPIP", and then before the position is closed to stop loss, otherwise what is the function of this parameter? I do not know if this can not be done, if there are technical limitations to make it happen. We Can anything be done to "TradeEvent" start point?
The strategy is based on the principle that in trading the only things really are certain are losses! Sooner or later one position will at a loss, but the strategy places the take profit of recovery orders at the same level of stop loss, following the price movement. But to do this recovery orders should open earlier, at a price that is more favorable and is still following that movement. If you open only after the closing stop loss, the price will be less favorable, and moreover, the recovery order, with larger size, will become as an order by himself, which will go into profit as a loss.
This is very important, this alone is worth 80% of the strategy. Of course it tested and will see how it works, but I think with this principle is possible to exploit an anomaly in the pattern of markets.

3) You may think that I study the night, however, I got another idea, a security system for not too overload the leverage and protect the account.
I would like, if possible, a parameter to set a predetermined profit level, eg. € 100. After achieve this profit, the strategy closes all open orders immediately (regardless that they are at a loss or profit) and erases all pending orders. Then the process starts all over again, or it would be great if you could choose whether to start or simply stop. Even more beautiful would be if, after a certain number of "restart", you could set a level of increase of the standard size.
For example, if the maximum profit level is 100 EUR, after 10 restarts, and again through having achieved a profit of 1,000 €, the next starting open positions no longer with size standard 0,001 to 0,002 but, having achieved greater equity in able to withstand a higher lever. And maybe you can also set a higher profit level, eg. 200 euro.
I would like, if possible, and it would be beautiful scenery, if all these parameters could be included in the initial menu:
For example:
"Restarting at level profit?" YES or NO
"Profit Level" 100
"Number of Restart before increment size" 10 - "Position Size increment" 0,001 - "Profit Increment" 100
etc ...
Or get an indication of where to intervene within the blocks to change these parameters.

The most important thing is to develop the n. 2. I give the directions, then of course we need your skills.
Anyway thank you again so much, you've been very kind. And thanks as always to have entered notes in the blocks for me, to make me understand better.
I believe in this strategy. Second and, if a step at a time, we can put it in place, you can do with the results.

And then we go to celebrate in Geneva!

I await your response.

Greetings

P.S.
We must also remember that just triggered the second recovery grid (size 0.003), the first order that is losing (size 0.001), which is part of the primary grid, then becomes a position that belongs to the secondary grid, so it must change the take profit, and adapt it to that of the secondary grid.
But these I had also already explained in previous posts. Thank you


 
 Post subject: Re: BIDIRECTIONAL GRID STRATEGY Post rating: 0   New post Posted: Tue 26 Jul, 2016, 18:20 
User avatar

User rating: 0
Joined: Thu 05 Nov, 2015, 22:29
Posts: 16
Location: ItalyItaly
Hi to all,

I can not run the recovery loss level ("LossLevel_SecondGridPI" user's variable), set at -30 pips.
Can someone help me?

Thanks!


 

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