Dukascopy
 
 
Wiki JStore Search Login

Not to open position if 5 consecutive red candles are made
 Post subject: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Thu 09 Nov, 2017, 16:43 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi,

My question is how to have no open position if 5 consecutive red candles are made.
Image

I am trying to make it like that (see attachment). Unfortunately, it does not work. Could you advise, please?

Kind regards,
kostakis


Attachments:
Chart_USD_CAD_Hourly_snapshot.png [45.11 KiB]
Downloaded 627 times
File comment: The bad one.
five_red_candles.vfs [31.8 KiB]
Downloaded 159 times
five_red_candles.vfs [32.22 KiB]
Downloaded 166 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: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Fri 10 Nov, 2017, 21:33 
User avatar

User rating: 5
Joined: Thu 04 Aug, 2016, 04:51
Posts: 61
Location: CanadaCanada
Hello Kostakis,

I am new but definitely an enthusiastic learner of Visual JForex, so please forgive me if my reply is not helpful to you. However when I opened your strategy, the first mistake I noticed since I myself have done it with my own strategy is that your "Default Period" in the "Get Historical Candle" component is set to 10m and not 1Hr. So correct that and back-test to see if it fixes the issue.



With Regards!


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Sat 11 Nov, 2017, 14:26 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi FXRabbit,

Thank you for your answer. I really appreciate that. You are right the "Historical Candle" block should be set to 1H Candle Period. But, in this particular case, it does not matter. Changing the Candle Period can't resolve the problem I am talking about. In other words, it can't change the very logic of the unit of blocks, I am going to implement in my strategy. My question is, how to avoid the opening of any position after 5 consecutive red candles. I suppose the very logic should be changed somehow. Unfortunately, I don't know, how. :(
Anyway, thank you for your help.

Kind regards


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Sun 12 Nov, 2017, 12:11 
User avatar

User rating: 5
Joined: Thu 04 Aug, 2016, 04:51
Posts: 61
Location: CanadaCanada
Greetings,

I looked at your strategy this time in more detail and found some more inconsistency. Following are the changes I had to make to your version of the strategy before backtesting it for May 1st, 2017:-
1- Changed the default instrument from EUR/USD to USD/CAD,
2- Changed the default period from 10min candle to 1Hr candle,
3- Added Position Amount logic & tested the strategy with and without it.

Before you continue to look at the results, I will remind you that the "Assign" component and the "Counter" logic are few of the things I am still learning and please forgive me if I am wrong here, but from what I can see - your strategy looks at the previous candle to check whether it was red or green and if it was green then it adds an amount of 1 to the counter and if it was red then it resets the counter to zero. As long as the counter is below 5 but equal to or above 1, it will trigger a sell order and as soon as the counter = 5, then it will reset itself back to 0. In other words, it simply waits for the completion of a green 1Hr candle before opening a sell position!

Now, first lets take a look at the minor changes I made to your strategy before testing it.

Image

The following is the result I get when I used the logic that only 1 trade can be opened and remain active until it has not closed. Comparing it to your own screenshot of the chart provided for the consecutive 5 red candles, I believe and as well hope that there are more logics within your main strategy for executing a sell order because the strategy you have uploaded here on this thread do not reflect the same result as shown on the following chart screenshot when compared to your chart's screenshot.

Image

Image

The following is the result when your strategy is allowed to open multiple positions:-

Image

Image



Most definitely not something you want since it is 5 consecutive red candles that you want your strategy to be tracking, so here is one solution for such a task set up:
-> IF Candle Open is greater than Candle Close -> then the CALCULATION component gets a SUM of 1 -> and IF the Counter is not equal to or greater than 5 -> OPEN AT MARKET sell order can be placed.

Though I will alert you that such a set up will still continue to open a sell position after every green candle and also on every red candle but the only time it will not open a sell order is when there are 5 or more consecutive red candles. More importantly, if the counter is being reset back to 0 after 5 consecutive red candles, then it will open a sell order on the 7th and following 8th & 9th red candles, unless other logics are added to your strategy.


Cheers!


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Mon 13 Nov, 2017, 21:45 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Dear Friend,

Thank you for your deep research. You did a great job. However, as was stated before, I provided just a small part of my strategy. It's just one unit of blocks and, of course, some other logics was added to my strategy. So, testing just one unit of blocks, you can not get the same results, as on the picture attached. I don't want to bother you with the whole strategy, it's quite big and complicated. Moreover, I can ensure you that all your proposals such as:
1- Changed the default instrument from EUR/USD to USD/CAD,
2- Changed the default period from 10min candle to 1Hr candle,
3- Added Position Amount logic & tested the strategy with and without it,
are implemented in my strategy. Unfortunately, it keeps opening positions after 5 consecutive red/green candles. Thus, I need some other logic for this particular unit of blocks, I was talking about.
Please, share your ideas.

Kind regards


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Tue 14 Nov, 2017, 14:20 
User avatar

User rating: 5
Joined: Thu 04 Aug, 2016, 04:51
Posts: 61
Location: CanadaCanada
Greetings again,

I am glad to know that your original strategy is more complex than the one attached to your thread here. Also, as mentioned in my previous post, if the Counter logic be used as it is in its current setup then it is opening a sell position after the completion of one green candle and should the setup be changed to as how I described it, then it will open a sell position each time but will be restricted from opening a sell position when there are 5 consecutive red candles.

From reading your new post above, I believe that you want a strategy setup on Visual Jforex where no sell order will open when there are 5 consecutive red candles and no buy orders are placed when there are 5 consecutive green candles or no trading in either direction irrespective of when there are 5 red or green consecutive candles ? Also, what about the UNCH prices or Doji candles ? Sorry for asking so many questions because each kind of logic needs or must relate to the overall set up of the whole strategy and therefore it is important to know the overall logic of a strategy before attempting to use the components available at our disposal to create any kind of strategies, from the most simple ones to very complex and advanced kinds.


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Tue 28 Nov, 2017, 12:00 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi again,

Anyway, the problem was not resolved. Your idea does not work in this case, my friend. Could anybody share any ideas, please?


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 1   New post Posted: Wed 29 Nov, 2017, 15:58 
Visual JForex expert at Dukascopy
User avatar

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

Back to your initial requirement:
Quote:
Hi,

My question is how to have no open position if 5 consecutive red candles are made.


The simplest way to do this is to use 5 Get Historical candle blocks each one with a shift value from 1 to 5. Then 5 IF conditions checking open > Close then all linked in serial way so that once the flow passes your 5 conditions you hold the trading.

OR

to use smarter way just like the dynamic shift I proposed in this thread:
https://www.dukascopy.com/swiss/english ... 195#p92195

which more reliable when it comes to verifying high numbers of candles (like 10 and more, as you cannot work with 50 "get historical candle" for instance)


 
 Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 1   New post Posted: Thu 30 Nov, 2017, 16:10 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
here is a fantastic piece of blocks that should help you :D
Enjoy !


Attachments:
Advanced_iterationFinal.vfs [38 KiB]
Downloaded 180 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: Not to open position if 5 consecutive red candles are made Post rating: 0   New post Posted: Fri 01 Dec, 2017, 21:51 
User avatar

User rating: 1
Joined: Wed 30 Jul, 2014, 14:33
Posts: 95
Location: Lithuania, Vilnius
Hi,
It's really good. I tried the one you provided in your previous post. It's the same isn't it? So, it works perfectly, and it opens no trades after 5 consecutive red/green candles. The problem is that this fantastic piece of blocks also prevents the strategy from opening other trades (not just after 5 consecutive red/green candles). I can not say that it totally prevents the strategy from opening any trades, anyway my strategy opens less trades. I tested my strategy with this piece of blocks and without it. And I realized that this piece of blocks is blocking some good trades (not after 5 consecutive red/green candles). I am not sure that there is any possibility to resolve this kind of problem. Anyway, I would be very grateful for some good advice.

Kind regards


 
The Best Answer  Post subject: Re: Not to open position if 5 consecutive red candles are made Post rating: 1   New post Posted: Tue 05 Dec, 2017, 10:41 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Well,
This fantastic piece is the implementation of your idea so if it result in missing opportunities I would say this is a business level that you should manage as the technical side is covered


 

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