Dukascopy Support Board

Inconsistent behaviour
Page 1 of 1

Author:  vtechdir [ Thu 01 May, 2014, 01:47 ]
Post subject:  Inconsistent behaviour

Dear Support,

Thank you very much for your assistance in the past and for the work you're doing to improve the tools available.
I am running on Ubuntu12.0.4 and everything works fine, except that I encountered some interesting situation.
I atatched the strategy developed in vJForex, which I moved to JForex Demo environment for backward/forward testing. Since I cannot watch the screen for hours I linked it to a Python script that sends messages to my mobile via Skype (attached).
The strategy is supposed to have Only One position Open(first "If" block after variables declaration) and it should be opened with the closing price of the last candle when all conditions have been met (the PendingOrder blocks).

The issues is obvious in the attached 2_Orders_log.png - observed in Forward Testing (running during the day)
The issue I encountered: is that it raises two orders at prices that have nothing to do with the prices where the pair is at, on one hand. Where does it get those prices from ( I mean < )
As expected the orders are Both filled at the nearest price. On the other hand, the second issue is that only one position should be running at all times, thus having two positions opened is not desired.
The last issue is that the positions are both closed immediately, during the candle formation. Yes, the candle will finish crossing the exit line, but the intent (or so I understand it) was that only if the candle closes below Hatema, should the position be closed and not during ( and this seems to be happening a lot).

Please advise what I should do to achieve the intended behaviour.

Kind Regards


2_Orders_Log.png [529.66 KiB]
Downloaded 261 times
SMS_EUR_Strict013.java [57.25 KiB]
Downloaded 107 times
Long_and_Short_v17_Strict013.vfs [77.35 KiB]
Downloaded 97 times

Author:  amine_chourou [ Thu 01 May, 2014, 14:05 ]
Post subject:  Re: Inconsistent behaviour


Thanks for the detailed information.
I went through your VFS strategy and noticed couple of remarks that I input as notes inside the attached vfs file. Please check them and let me know your thoughts.

It is clear that your strategy wasn't subscribed to EUR/USD despite the default instrument variable is set to EURUSD i.e default pair, but in such cases, where no filters are applied, the strategy retrieves all the instrument prices and could trade on a given price which doesn't cope with the instrument pair. This assumption is not fully tested and requires more in depth investigation but I believe that adding instrument filter could resolve the problem.
The prices that you get are clearly USDJPY and GBPUSD prices applied to EURUSD instrument which led to transforming limit prices to market prices in some cases (depends on the side and submitted 'obsolete' price)
the last point related to your entry conditions: If the check is made on the close candle price and your indicator level then the next entry sould be indeed made on the following new candle: But in this particular case, you need to test again the strategy and check if the same error is happening.
..And yes: the open orders limitation to 1 should work in any case (even if in case of multi-currencies strategy ) but again we need to investigate and try to reproduce the issue.


Long_and_Short_v17_Strict013_1.vfs [79.25 KiB]
Downloaded 116 times

Author:  vtechdir [ Fri 02 May, 2014, 00:11 ]
Post subject:  Re: Inconsistent behaviour

Hi Amine,

Very good pick about the prices picked up from the stream, thank you.
Yes, your suggestions are valid and will be carried forward, however at this stage I am researching as to how can make the strategy to deal multiple pairs (eg. US pairs, JPY pairs, X-pairs, etc). If you have any suggestions, I'll be happy to evaluate them.

I will retest after the filter is introduced and will update you with the results.

Thank you and regards

Author:  vtechdir [ Fri 02 May, 2014, 03:24 ]
Post subject:  Re: Inconsistent behaviour

Hi Amine,

I compiled and started to run the new strategy. Yes, this time it only picks up the right pair EUR/USD, however unfortunately as per attached picture it still accepts 2 simultaneous orders.

Sorry, something is still not right. Please let me know your thoughts.

Thank you and regards

Still_2_orders.png [202.85 KiB]
Downloaded 234 times

Author:  amine_chourou [ Fri 02 May, 2014, 14:34 ]
Post subject:  Re: Inconsistent behaviour


I've launched your strategy in live run mode (Demo env.) and got the following trade:

2014-05-02 12:30:08 Order FILLED at 1.3831 (#240487831 ENTRY BUY 0.001 mil. EUR/USD @ LIMIT 1.38622 IF ASK <= 1.38622) - Position #60926351
2014-05-02 12:30:00 Order ACCEPTED: #240487833 TAKE PROFIT SELL 0.001 mil. EUR/USD @ LIMIT 1.40622 IF BID => 1.40622 - Position #60926351
2014-05-02 12:30:00 Order ACCEPTED: #240487832 STOP LOSS SELL 0.001 mil. EUR/USD @ MKT IF BID <= 1.38472 - Position #60926351
2014-05-02 12:30:00 Order ACCEPTED: #240487831 ENTRY BUY 0.001 mil. EUR/USD @ LIMIT 1.38622 IF ASK <= 1.38622 - Position #60926351
2014-05-02 12:30:00 Order ENTRY BUY 1000 EUR/USD @ LIMIT 1.38622 IF ASK <= 1.38622 is sent at 2014-05-02 12:30:01.221 GMT by the strategy "Long_and_Short_v17_Strict013_1": from the local computer

There was a single order sent and filled but I'm still not fully getting why your strategy is sending 2 identical orders.
I've already experienced such case but it was due to strategy subscribed to both BID and ASK prices which explains the double trades.

PS: Correct me if I'm wrong: We're talking about the strategy "Long_and_Short_v17_Strict013" and not "SMS_EUR_Strict..." as shown in you previous screenshot.


Author:  vtechdir [ Sat 03 May, 2014, 05:02 ]
Post subject:  Re: Inconsistent behaviour

Hi Amine,

I ran the strategy and this was the only instance it raised 2 orders. I will monitor it again next week. The SMS strategies have only a few additional lines when this event occurs, you can check it in the code. It, call a Python script after setting a cmd="parameter".

I will run it again next week and report back.
Do you have any suggestions for multiple pairs?

Thank you and kind regards.

Author:  vtechdir [ Tue 06 May, 2014, 01:35 ]
Post subject:  Re: Inconsistent behaviour

Hi Amine,

I really hoped I was wrong and everything has been sorted out.

As the atatchement shows, the second position was opened while the first one was already open and they both have been closed at the same time.

Any Ideas?

Kind Regards

2_positions.docx [7.24 KiB]
Downloaded 65 times

Author:  amine_chourou [ Tue 06 May, 2014, 10:43 ]
Post subject:  Re: Inconsistent behaviour

Hi there,

At this stage, I had the attached results in the bottom of your document. I launched your strategy in remote run since 3 days and I did not not experienced any similar issue.
I need more time to check the servers logs Vs users logs to get a clearer picture.


2_positions_updated.docx [91.9 KiB]
Downloaded 113 times

Author:  vtechdir [ Tue 06 May, 2014, 11:01 ]
Post subject:  Re: Inconsistent behaviour

Hi Amine,

Thank you very much for the quick reply. I suppose that what you included at the bottom of the document are the results of your run_on_remote of the strategy. It appears that the tiems for the orders are different. I will try to make sense of them, if not will come back to you.

In the menatime I discovered another issue: The strategy is supposed to exit when the Close(price) crosses T3(Hatema). In the atatched exmaple the Open(Price) closes T3(Hatema) and the position is closed. We can easily see that if the logic would have been followed the exit would have been in the money.

This is really a great concern, since price may cross T3(Hatema), but it will not close (Below/Above) for a good run.

I attach the picture.

Kind Regards

Exit_on_Open.png [54.71 KiB]
Downloaded 226 times

Author:  amine_chourou [ Tue 06 May, 2014, 13:54 ]
Post subject:  Re: Inconsistent behaviour


Regarding your second question about the position closing it is obvious from your strategy that closing commands are based on Last Candle close price wgich means that if a given candle is closed and its closing price is below the current Hatema then the previous position should be close straight <=> on the next available price i.e in your below screenshot the open price of the next candle.
If you need to close your positions on the next candle's closing price then you have to work with get historical candle and check the entry conditions with the variables of the previous candle then close IF the close price of the next candle is crossing...
I don't think that we have an issue in here, it is a matter of strategy adjustments...

..Regarding the reports that I've sent you: Yes they comes from a remote run that I performed and the time stamp is therefore corresponding to the server's time.


  Page 1 of 1