Dukascopy
 
 
Wiki JStore Search Login

Multiple order per candle
 Post subject: Multiple order per candle Post rating: 0   New post Posted: Wed 10 Jul, 2013, 12:44 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi all,

In the attached picture, in the red square, there are two candles crossed by a blue line. On that candle there have been several hundred positions opened and closed. Please note the count of positions before those candles. I watched it as it happened and indeed that was what happened. This situation happened several times in addition to the examples in the picture.

These lead to a significant loss.

I attach the picture and the strategy, please advice how to overcome the issue.

Kind Regards


Attachments:
MyStrategy03.vfs [80.8 KiB]
Downloaded 636 times
Multiple orders per candle.docx [149.53 KiB]
Downloaded 608 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: Multiple order per candle Post rating: 0   New post Posted: Wed 10 Jul, 2013, 23:25 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Greetings.

I'v just tested your strategy and it works fine. No multiple positions, one at a time.
Please provide more evidence of the problem.


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Thu 11 Jul, 2013, 00:38 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Thank you for your reply.
Yes, they are one at a time, but on those situations there are a few hundreds. Normally it should not Open/Close on the same candle, anyhow not that many. Also, assuming that this is what is supposed to do according to the strategy, the behavior is different a few candles further.
I use 1 pip slippage, 10 pips stop loss and 50 pips profit target.

I test the strategy against last week with the parameters in the attached document.

Kind Regards


Attachments:
Test_Parameters.docx [256.62 KiB]
Downloaded 546 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: Multiple order per candle Post rating: 0   New post Posted: Fri 12 Jul, 2013, 14:16 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Tested with parameter you'v sent. Still no signs of multiple positions.


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Fri 12 Jul, 2013, 22:30 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Appreciate your effort and time. Just to be sure we mean the same thing:
1. There are not multiple simultaneous positions,
2. On the same candle there are hundred of positions open and closed one after the other.

This generates the blue lines. Do you have any blue lines on the candles?

I built the strategy for the short and it does the same thing. Occasionally it triggers multiple open/close on the same candle. Now I am thinking to build a rule to not allow to open a new position on the candle where a position has been closed. Can you provide some clues?

Kind Regards


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Mon 15 Jul, 2013, 11:34 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello.

I'v tested ones again (on last week) and there are piles of positions. So lets correct your strategy:
1. Use onCandle start point. This is the main problem of the strategy. First it overloads your processor HEAVILY!! It calculates 15 indicators every TICK.
Because of this strategy lags and when indicators show "Buy" it starts to open position every tick.
So first and the main use onCandle start point.
2. After opening position Strategy closes it at the same moment. Opening and Closing conditions are overlapping.
For example normal logic: if X<20 then open; if X>80 then close. But in you situation we have something like: if X<60 then open; if X>40 then close;
So make corrections in the trade logic.
3. It is really hard to understand the logic of your strategy. So either arrange it in more readable way or make text description of it.


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Wed 17 Jul, 2013, 02:34 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Thank you very much for helping and believing that it is a complex strategy. In my view it is a very simple one to help me understand how vJForex works and test a few assumptions.
The test period is 01.07.2013-08.07.2013 - not a good week for longs.

I attach a workflow diagram for the Strategy (X2 is older then X1 - as you used in another example and have used ATR < 0.00055 to not trade during times of very low activity)
I changed the Start to be "On Candle" and used the settings form the picture.
I have the following problems:

1. Still multiple entry/closed on the same candle
2. It exits on end of candle, thus it slips way beyond stop loss
3. If CCI< 0, T3 (Hatema)decreases, MACD decreases - I expected to get out and cancel the position, maybe something wrong in logic?
4. It enters after a candle close is lower than T3 (not in the logic)
5. It does not take entries that qualify

I'll be happy to send you the chart I am getting if you let me know how. I attach a snapshot of the chart, it illustrates some of the issues mentioned above.

Your help is appreciated and if anything is required, please let me know and will provide.

Regards


Image


Attachments:
Chart_5min.png [67.41 KiB]
Downloaded 1362 times
Settings_5min.png [182.39 KiB]
Downloaded 695 times
LongStrategy.pdf [43.01 KiB]
Downloaded 565 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: Multiple order per candle Post rating: 0   New post Posted: Wed 17 Jul, 2013, 13:14 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
OK. That problem is hard to catch.
You can use debugging tools.
First. Drag and drop variables on free space. That will show you there values while testing.

Image

Second. Make break point on blocks that open positions. It is 'stop' button in every block.
Strategy will stop when this blocks are activated so you can see current situation on pause.

Image


Attachments:
Pic2.png [32.49 KiB]
Downloaded 1129 times
Pic1.png [14.48 KiB]
Downloaded 1062 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: Multiple order per candle Post rating: 0   New post Posted: Thu 18 Jul, 2013, 01:45 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Good advice. I tried it and there is some strange behavior. You may be able to point out the issue. In the attched picture both Hatema_current < Hatema_previous and also MACCD_Current< MACD_Previous (though negative numbers - but since they are double it should not make any difference).
On the left side, I extracted hte variables and their values.

However the next step, to Close and Cancel the position is not excuted.
I tried with a "Close and Cancel Position" box after each condition. it still did not execute it :)

Do you have any clues?

Kind Regards
Image


Attachments:
No_exit.png [225 KiB]
Downloaded 1167 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: Multiple order per candle Post rating: 0   New post Posted: Thu 18 Jul, 2013, 12:11 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
First. Closing logic has to be defined:

IF Hatema_current < Hatema_previous AND MACCD_Current< MACD_Previous AND CCI<0 THEN Close

Image

IF Hatema_current < Hatema_previous OR MACCD_Current< MACD_Previous OR CCI<0 THEN Close

Image

There is a big difference.

Second. Try to use Position viewer + Cancel blocks. It can be more efficient.

Image

Looking forward for more questions. Really interesting Strategy.


Attachments:
Pic3.png [24.08 KiB]
Downloaded 1098 times
Pic2.png [51.29 KiB]
Downloaded 1152 times
Pic1.png [38.67 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: Multiple order per candle Post rating: 0   New post Posted: Fri 19 Jul, 2013, 00:53 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Thank you for the OR condition. I implemented it and it still did not do what's expected. So, I started to look in other parts of the strategy, check on BreakEven and for the number of active positions. Please help in the logic to ensure there is only one position opened at the time.

The attached picture presents that there were 7 positions opened at that moment.

Something might not work as expected and I assume that this was the problem all along.

Kind Regards
Image


Attachments:
Positions.png [190.66 KiB]
Downloaded 1222 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: Multiple order per candle Post rating: 0   New post Posted: Mon 22 Jul, 2013, 12:59 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
I believe you'v done some changes on strategy.
Can I see new version?


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Tue 23 Jul, 2013, 00:16 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Vadim,

Here it is!

Regards


Attachments:
MyStrategy03_onCandle_noShift.vfs [81.09 KiB]
Downloaded 576 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: Multiple order per candle Post rating: 0   New post Posted: Tue 23 Jul, 2013, 17:19 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
OK. First of all now strategy is at least readable, well done.
Second I still can not understand the logic of you strategy so I don't get where to search for the bug.
So lets do it other way. Give a description of the strategy(from A to Z) and I'll create it for you in Visual.
Then we can discus it and redesign.


 
 Post subject: Re: Multiple order per candle Post rating: 0   New post Posted: Wed 24 Jul, 2013, 03:00 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

I created a document (attached) that you can edit if need be.
The Strategy should have only one Open Position at all times and should not open a new position on the same candle that it exited.
At a future date, I may think to open a new position on the exit candle, but only in the opposite direction (cancel Long, open Short if conditions are met)

Regards :(


Attachments:
Strategy_Description.docx [5.78 KiB]
Downloaded 588 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: Multiple order per candle Post rating: 0   New post Posted: Wed 24 Jul, 2013, 13:26 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Instruction have made it easier.
That is what we receive by following your instruction:
download/file.php?mode=view&id=4128

There is little uncertainty in logic to be clarified. In first two conditions MACD and EMA are compared, And it gives 4 situations
1. LastPrice is above EMA and MACD is positive.
2. LastPrice is above EMA and MACD is negative.
3. LastPrice is below EMA and MACD is positive.
4. LastPrice is below EMA and MACD is negative.
And it is not rely clear what to do in each situation/ Can you clarify each of them?


Attachments:
LongOnly.vfs [57.13 KiB]
Downloaded 942 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: Multiple order per candle Post rating: 0   New post Posted: Thu 25 Jul, 2013, 00:35 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Thank you very much, I appreciate your effort and dedication.
Before answering your questions, let's provide some feedback on the strategy (I hope it will help in the understanding of what is meant to be doing)
I understand that it is work in progress (not everything is finished) and thus hope it will save you time in the long-run

The Good - There are no multiple orders (great job!) and the entries are quite good (it will be easier to analyse if we could have the cross-hair cursor).
The Bad - it does not exit at the StopLoss + Slippage ( at least this is the maximum loss I expect per position)
The Ugly - it does not exit when either: CCI <0 (becomes negative) or MACD is decreasing or T3 (Hatema is decreasing); eg. Position 7 in the picture becomes a significant loss, after being in good profit for most of the time. (CCI becoems negative several times during this trade).

Now the answers that are due:
1. LastPrice is above EMA and MACD is positive.
2. LastPrice is above EMA and MACD is negative.
3. LastPrice is below EMA and MACD is positive.
4. LastPrice is below EMA and MACD is negative.
Image

Following the previous workflow diagrams, let's elaborate each case:
1. LastPrice is above EMA and MACD is positive.
Follow the conditions on the first diagram, only place a BuyOrder when all of the following conditions are met:
LastPrice > T3 (Hatema)
MACD is increasing
CCI is increasing
Stochastic is increasing
Note - the first condition LastPrice > T3 introduces a delay in placing the order, however it also increases the likelihood of the trade being successful. In the future I may try to remove it and check that the price is above it after the second candle (if it is not, the trade has failed and should exit immediately).

2. LastPrice is above EMA and MACD is negative.
This is a situation of less likelihood success, therefore in the future I may have a tighter management on it. However, occasionally it can provide significant upshot. The action is the same:
Only place a BuyOrder when all of the following conditions are met:
LastPrice > T3 (Hatema)
MACD is increasing
CCI is increasing
Stochastic is increasing

3. LastPrice is below EMA and MACD is positive.
This is the situation that perhaps will generate the most losses in testing. In manual testing, usually it got there during a Short correction or consolidation. This is the situation that requires very responsive StopLoss.If it is to go Long, the price may move until the MACD becomes positive, but you need clear instructions:
Only place a BuyOrder when all of the following conditions are met:
LastPrice > T3 (Hatema)
MACD is increasing
CCI is increasing
Stochastic is increasing
Depending on the result of testing, in the future I might decide that this is a StayOut condition.

4. LastPrice is below EMA and MACD is negative.
This is the condition for Short consolidation, correction or sudden trend change. To ensure that the price may move upwards and avoid tight range movement, the price has to be fairly away from EMA. This adds a new condition:

If LastPrice + 25pips < EMA, then:
Only place a BuyOrder when all of the following conditions are met:
LastPrice > T3 (Hatema)
MACD is increasing
CCI is increasing
Stochastic is increasing

I hope this is clearer, please let me know if more information is required.

Kind Regards


Attachments:
LongOnly.png [99.17 KiB]
Downloaded 1097 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: Multiple order per candle Post rating: 0   New post Posted: Thu 25 Jul, 2013, 10:50 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello.

The Bad and the Ugly are one little mistake, corrected in LongOnly_v1.vfs

To sum up, in situations 1., 2. and 3. we open Long position.
In 4. we just add one more condition (LastPrice + 25pips < EMA) and open Long position.
If I understand your logic right then LongOnly_v2.vfs would be better solution.


Attachments:
LongOnly_v2.vfs [61.03 KiB]
Downloaded 577 times
LongOnly_v1.vfs [57.68 KiB]
Downloaded 682 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: Multiple order per candle Post rating: 0   New post Posted: Mon 29 Jul, 2013, 10:39 

User rating: 0
Joined: Mon 17 Jun, 2013, 23:30
Posts: 48
Location: Australia, Melbourne
Hi Vadim,

Great job, I was busy over the weekend and I only got to do some basic testing, however I intend to perform some serious testing on these strategies.
I added 2 changes to the strategy ( I attach the strategy):

1. Entry only when Hatema is increasing (Hatema_Cur > Hatema_Prev)
2. Exit when Close_Price is below Hatema_Cur, additional exit condition.

The Strategy does what I expect it do do, with the exception of the ATR filter. It seems to me that is ignored( please see several screen-shots in the Word document)
Another file is when Hatema_Cur < Hatema_Prev - it should not have any open position.


Well, it looks like we're getting close to the end of our collaboration on this instance. Thank you very much, appreciate your dedication, commitment and patience.

Kind Regards

Image


Attachments:
LongOnly_v1_vt_Hatema.vfs [58.56 KiB]
Downloaded 614 times
Hatema_Cur [72.12 KiB]
Downloaded 1112 times
ATR_Error.docx [4.56 KiB]
Downloaded 566 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: Multiple order per candle Post rating: 0   New post Posted: Mon 29 Jul, 2013, 13:39 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
ATR Shift is 1 so it uses index at previous candle.
You can set ATR Sift = 0 to use value at current candle.
Your strategy Version 1 is finished.
But do not stop on achieved level.


 

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