|
Strategy with individual candles and individual trailer |
Lunas
|
Post subject: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Wed 14 Sep, 2016, 16:27
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine, I try to build a strategy based on candles with an "individual" period of time. As a beginner in VJF, I could build a strategy which is running, but it's far away from doing what it should do. Therefore your help is highly appreciated! (I attached my "work" - you might burst out laughing when looking at it!  ) The logic itsself is simple: It is intended to measure the increase / the decrease of the price in a certain period of time to derive trading decisions. The strategy should use a candle period of x milliseconds. If the price moves more than x Pips during this candle period, a position is to be opened @market immediately. Please note, that the strategy should be able to cover possible gaps when measuring the increase / the decrease of the price (please see attached photo). In other words: We need something like a threshold. If the movement of the price exceeds this threshold (threshold means: x Pips in y milliseconds), than a position is to be opened. To avoid my computer being overloaded when running this strategy, I strongly prefer it to be built "onCandle" rather than "onTick". But I'm not sure whether this is possible at all. If it should be correct, that a strategy as described above, cannot run only "onCandle", than it could be an alternative, to open a position not straight after the threshold is exceeded, but with the open of the next candle of our "individual" period of time (please see attached photo). Regarding SL: As soon as the position is x Pips in profit, the SL should move to entry price +1 Pip (long) / entry price -1 Pip (short) to cover slippage and trading fees. And after that, the SL should move as a trailer according to the low (long) / high (short) of the previous candle - but with a distance of x Pips to cope with small trends against my position (please see attached photo). If anything is unclear, please do not hesitate to ask! Yours sincerely Lunas
Attachments: |
strategy_photos.pdf [78.27 KiB]
Downloaded 158 times
|
strategy_sketch.vfs [44.14 KiB]
Downloaded 182 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.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Thu 15 Sep, 2016, 10:43
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi,
According to your description, I've made the attached example that implements the idea of building 1000ms bars and the entry conditions. I've also inserted some comments to clarify the way it is built. I'll let you add the SL and TP conditions, let me know if you have any questions
Cheers
Attachments: |
1000ms_bars.vfs [32.97 KiB]
Downloaded 204 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.
|
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 1
|
Posted: Thu 15 Sep, 2016, 18:16
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine,
thanks for your immediate answer and your detailed annotations in the strategy. Very helpful, indeed! The first backtests showed remarkable results, the logic works correct and as expected. Against my expectations my computer is not overloaded when running this "onTick"-strategy. Now I'll try to make some progress regarding the trailer.
Thank you for your support! Your work is pretty impressive!
Yours sincerely Lunas
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Wed 18 Jan, 2017, 18:45
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine,
coming back to the trailing stop of my strategy....... In the meantime my strategy worked with a standard trailing stop from VJF and I tried to improve the exit logic a little bit. Actually, it doesn't work as it should owing to some mistakes. Maybe You can have a look at it - Your help is highly appreciated!
The idea is, that the initial SL should move the first time as soon as the position is x pips in profit. It should move above entry price (long) and below entry price (short). After this is done, SL should move according to the previous candle's low minus x pips (long) and according to the previous candle's high plus x pips (short). To enable the strategy to work with pip-values like "1,5" or "10,5", I tried to work with "price" instead of "pips".
I attached a photo and the strategy as far as I was able to build it on my own. If you have any questions please do not hesitate to ask.
Yours sincerely Lunas
Attachments: |
individual_trailing_step.pdf [44.07 KiB]
Downloaded 119 times
|
Trailing_Sketch.vfs [55.8 KiB]
Downloaded 154 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.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Fri 20 Jan, 2017, 14:32
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi there,
I've made an example for you from scratch, maybe it will clarify things or route you to another path to achieve your idea. Please consider the global idea and adjust as per your requirement
Attachments: |
ExampleToStudy.vfs [39.46 KiB]
Downloaded 178 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.
|
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Tue 24 Jan, 2017, 18:35
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine, thank you for helping me once again! I tried to understand the logic you built, to combine it with the entry logic and to add the "short-part" of the trailer. In this connection I found a "calculation-block", which is not linked with any other block (please see file "ExampleToStudy_2"). I'm not sure, what to do with it... After combining the entry logic and the trailing stop you built for me, I did a backtest. It turned out, that the SL doesn't move at all (I attached the message log). Therefore I ask you for looking at the strategy once more. Thank you in advance! Yours sincerely Lunas
Attachments: |
ExampleToStudy_2.vfs [42.18 KiB]
Downloaded 162 times
|
full_logic.vfs [56.06 KiB]
Downloaded 163 times
|
message log.pdf [191.15 KiB]
Downloaded 126 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.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Wed 25 Jan, 2017, 17:15
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hello there ! I think the counter that I put belongs to another strategy so it has nothing to do there ..sorry for the confusion  Regarding your strategy: You should duplicate the short side with new variables including the position viewer output and the Boolean variables and also you have to use the "Position is Long" sub-variable of your output to check whether the position is long or short to proceed accordingly. Can you try this and let me know ?
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Fri 27 Jan, 2017, 13:11
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine,
thanks for your continuous help! I tried to follow your advices. On long-trades the trailer just does the first step, but than it doesn't move further. On the short side trailer doensn't move at all. I'm sure it has to do with the "No value in IF block" error which I couldn't manage to disappear. I found some advice exactly to this problem in the "Visual JForex User Guide", but obviously I implemented this advice the wrong way (please see attached file "full_strategy"). By the way: Although understanding the logic of the strategy in general, I wasn't sure, whether the trailer moves exactly like candle's low / candle's high or if there is a small distance to candle's low / candle's high. That's why I tried to implement one more block to calculate that (please see file "full_strategy_with_addition"). Maybe you can have a look at it - if this block is filled correctly, I would add it to the short-side as well.
As always: thank you in advance!
Yours sincerely Lunas
Attachments: |
full_strategy.vfs [60.38 KiB]
Downloaded 170 times
|
full_strategy_with_addition.vfs [62.29 KiB]
Downloaded 153 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.
|
|
|
|
|
 |
amine_chourou
|
 |
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Fri 27 Jan, 2017, 17:33
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi,
ALright, here is another method without position viewer but using a dedicated variable to identify each side. looks like the trailing works now but another problem was raised: In the trailing cycles; the strategy tries to change the SL order by the same one and this is due to the fact that the trailing is based on ticks (so quite frequent) and the SL price is based on high/low of the previous 1mn candle. So the result is the following conditions (Candle High < SLPrice and Candle Low > SLprice1) are verified on every tick of the same candle where the condition is already passed and the SL order already changed. But I'll help you later on regarding that ... Meanwhile, does the trailing logic make sense ?
Attachments: |
full_strategy_V4.vfs [55.99 KiB]
Downloaded 194 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.
|
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Fri 27 Jan, 2017, 17:44
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
In my opinion, as the trailing condition is based on the previous 1mn candle high/low any new high or low will come 1mn later so better ot move the trailing to candle start method and insert 1mn filter
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Mon 30 Jan, 2017, 11:39
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine, Quote: looks like the trailing works now but another problem was raised Quote: But I'll help you later on regarding that ... Obviously you have a solution for every problem occuring in VJF! Thank you for your immediate answer. I did some backtests in both directions (long as well as short) and thought about your last post: 1.) The trailing logic makes sense and the SL moves correctly according to candle's high / candle's low. 2.) You're right - we keep the trailing logic as you suggested. A strategy should be as simple as possible. And sometimes there are even situations, where the trailing logic you suggested leads to better results than the logic I had in mind. One question remains: After backtests were finished I got the following message: "Order state immutable". I've never had this before - what does it mean? Thanks again for your patience and help! Yours sincerely Lunas
|
|
|
|
 |
amine_chourou
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 0
|
Posted: Mon 30 Jan, 2017, 11:52
|
|
Visual JForex expert at Dukascopy |  |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hello ! Great to hear that this helped ! The answer to your question is actually in my previous post. Order state immutable means: Quote: In the trailing cycles; the strategy tries to change the SL order price by the same one and the solution to that is: Quote: as the trailing condition is based on the previous 1mn candle high/low any new high or low will come 1mn later so better ot move the trailing to candle start method and insert 1mn filter One more detail: Generally speaking, this method works well for you because your strategy is handling one order at a time. When you work with multiple orders/positions you cannot manage them using this method but only with position viewer / Loop viewer blocks which have the capability of managing arrays.
|
|
|
|
 |
Lunas
|
Post subject: Re: Strategy with individual candles and individual trailer |
Post rating: 1
|
Posted: Mon 30 Jan, 2017, 13:08
|
|
User rating: 2
Joined: Mon 02 Apr, 2012, 18:00 Posts: 61
|
Hello Amine,
thank you for the immediate clarification. Now I have a strategy working correctly from entry to exit and I've learned that the "order state"-message won't affect the trading.
Yours sincerely Lunas
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|