Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Problem with FIBPIVOT strategy
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=141&t=49506
Page 1 of 1

Author:  mad_max [ Mon 01 Jul, 2013, 12:29 ]
Post subject:  Problem with FIBPIVOT strategy

Hello.

I create strategy with VJF based on FIBPIVOT indicator (trade period = 1H, FIBPIVOT period = 1 DAY). When test strategy in VJF everything was OK, but after copying source code and paste into JF (compilation was successful ), got the following messages:
Quote:
11:09:24 Error in indicator: java.lang.ClassCastException: com.dukascopy.api.Period cannot be cast to java.lang.Integer @ com.dukascopy.indicators.FibonacciPivotIndicator.setOptInputParameter(FibonacciPivotIndicator.java:252)
11:09:24 Error in indicator: java.lang.ClassCastException: com.dukascopy.api.Period cannot be cast to java.lang.Integer @ com.dukascopy.indicators.FibonacciPivotIndicator.setOptInputParameter(FibonacciPivotIndicator.java:252)
11:09:24 Error in indicator: java.lang.ClassCastException: com.dukascopy.api.Period cannot be cast to java.lang.Integer @ com.dukascopy.indicators.FibonacciPivotIndicator.setOptInputParameter(FibonacciPivotIndicator.java:252)
11:09:24 Error in indicator: java.lang.ClassCastException: com.dukascopy.api.Period cannot be cast to java.lang.Integer @ com.dukascopy.indicators.FibonacciPivotIndicator.setOptInputParameter(FibonacciPivotIndicator.java:252)



I don't know is it compilation issue or is it a bug in FIBPIVOT indicator. So please help!
I attach both Visual JForex and java files.

Attachments:
JD_FIBOv4_2.java [24.2 KiB]
Downloaded 389 times
JD_FIBOv4_2.vfs [52.82 KiB]
Downloaded 402 times

Author:  vadim_berezhnoj [ Tue 02 Jul, 2013, 10:51 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Hello.

That is a system bug in FIBPIVOT. Will be fixed ASAP.
Thank you for proper bug report.

Author:  mad_max [ Tue 02 Jul, 2013, 16:20 ]
Post subject:  Re: Problem with FIBPIVOT strategy

vadim_berezhnoj wrote:
Hello.

That is a system bug in FIBPIVOT. Will be fixed ASAP.
Thank you for proper bug report.

Hello Vadim.
Thank You for respond.
I'm glad to help improve great tool such is Visual JForex :)
Hope VJF team will notice us (me) when this bug be fixed!
Regards

P.S.: This post should be move in "Bug report section" if is someone able to do that

Author:  mad_max [ Sun 14 Jul, 2013, 15:19 ]
Post subject:  Re: Problem with FIBPIVOT strategy

vadim_berezhnoj wrote:
Hello.

That is a system bug in FIBPIVOT. Will be fixed ASAP.
Thank you for proper bug report.


Hello.

After last update of Visual JForex I have no present bug in java code but when start strategy in JForex platform, strategy wont put any pending orders (with no errors in console). In Visual JForex everything work as I want to!?

So mine questions are:
1. Did fibpivot bug fixed in last update?
2. If 1st negative, is it any alternative way to get fibpivots support and resistance values in Visual JForex?
3. If 2nd is negative could someone be so kind to modify my java code above and make it strategy to work??? :oops:

regards

Author:  vadim_berezhnoj [ Mon 15 Jul, 2013, 10:49 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Hello.

We are still working on that bug.

But you can calculate Fib Pivots in the strategy separately. For example we know the formulas of FibPivot:
R3 = Pivot + 1.000 * (HIGH-LOW)
R2 = Pivot + 0.618 *(HIGH-LOW)
R1 = Pivot + 0.382 * (HIGH-LOW)
Pivot = (HIGH + LOW + CLOSE ) / 3
S1 = Pivot - 0.382 * (HIGH-LOW)
S2 = Pivot - 0.618 *(HIGH-LOW)
S3 = Pivot - 1.000 * (HIGH-LOW)

So we can use Calculation blocks to get Pivot, R1 and s1:

Image

And example strategy is in file attached.

Attachments:
FibPivot.vfs [24.49 KiB]
Downloaded 381 times
Pic1.png [170.3 KiB]
Downloaded 793 times

Author:  mad_max [ Tue 16 Jul, 2013, 11:12 ]
Post subject:  Re: Problem with FIBPIVOT strategy

vadim_berezhnoj wrote:
Hello.

We are still working on that bug.

But you can calculate Fib Pivots in the strategy separately. For example we know the formulas of FibPivot:
R3 = Pivot + 1.000 * (HIGH-LOW)
R2 = Pivot + 0.618 *(HIGH-LOW)
R1 = Pivot + 0.382 * (HIGH-LOW)
Pivot = (HIGH + LOW + CLOSE ) / 3
S1 = Pivot - 0.382 * (HIGH-LOW)
S2 = Pivot - 0.618 *(HIGH-LOW)
S3 = Pivot - 1.000 * (HIGH-LOW)



And example strategy is in file attached.


Hello.

I modified strategy as you suggest. Now strategy works similar as with fibpivot indicator and when test it in Visual JForex works OK. But when test in JForex platform, strategy wont open any pending orders!? I really have no clue why? Any help is much appreciated!

Reards

Attachments:
File comment: This is modified strategy
JD_FIBOv4_27.vfs [57.79 KiB]
Downloaded 379 times

Author:  vadim_berezhnoj [ Tue 16 Jul, 2013, 11:39 ]
Post subject:  Re: Problem with FIBPIVOT strategy

I'll take a look.
Was there any messages in "Message" window while real-time tests?

Author:  mad_max [ Tue 16 Jul, 2013, 12:05 ]
Post subject:  Re: Problem with FIBPIVOT strategy

vadim_berezhnoj wrote:
I'll take a look.
Was there any messages in "Message" window while real-time tests?


Message tab is empty.
But in Java Console got this:
max.JD_FIBOv4_27.If_block_17(JD_FIBOv4_27.java:280)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_15(JD_FIBOv4_27.java:256)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_16(JD_FIBOv4_27.java:272)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_13(JD_FIBOv4_27.java:242)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_38(JD_FIBOv4_27.java:485)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_12(JD_FIBOv4_27.java:235)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_11(JD_FIBOv4_27.java:226)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.MultipleAction_block_50(JD_FIBOv4_27.java:575)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.onBar(JD_FIBOv4_27.java:188)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.v.run(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.BN(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.Bm(Unknown Source)
   at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
com.dukascopy.api.JFException: Zero price not allowed in this order type
   at com.dukascopy.api.impl.connect.a.c.a(Unknown Source)
   at com.dukascopy.api.impl.connect.a.c.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.aq.d(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.aq.submitOrder(Unknown Source)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.PendingOpen_block_18(JD_FIBOv4_27.java:307)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_39(JD_FIBOv4_27.java:494)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_40(JD_FIBOv4_27.java:505)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_21(JD_FIBOv4_27.java:359)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_17(JD_FIBOv4_27.java:280)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_15(JD_FIBOv4_27.java:256)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_16(JD_FIBOv4_27.java:272)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_13(JD_FIBOv4_27.java:242)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_38(JD_FIBOv4_27.java:485)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_12(JD_FIBOv4_27.java:235)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_11(JD_FIBOv4_27.java:226)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.MultipleAction_block_50(JD_FIBOv4_27.java:575)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.onBar(JD_FIBOv4_27.java:188)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.v.run(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.BN(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.Bm(Unknown Source)
   at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
com.dukascopy.api.JFException: Zero price not allowed in this order type
   at com.dukascopy.api.impl.connect.a.c.a(Unknown Source)
   at com.dukascopy.api.impl.connect.a.c.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.aq.d(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.aq.submitOrder(Unknown Source)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.PendingOpen_block_18(JD_FIBOv4_27.java:307)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_39(JD_FIBOv4_27.java:494)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_40(JD_FIBOv4_27.java:505)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_21(JD_FIBOv4_27.java:359)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_17(JD_FIBOv4_27.java:280)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_15(JD_FIBOv4_27.java:256)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_16(JD_FIBOv4_27.java:272)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.If_block_13(JD_FIBOv4_27.java:242)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_38(JD_FIBOv4_27.java:485)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_12(JD_FIBOv4_27.java:235)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.GetTimeUnit_block_11(JD_FIBOv4_27.java:226)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.MultipleAction_block_50(JD_FIBOv4_27.java:575)
   at com.dukascopy.visualforex.mad_max.JD_FIBOv4_27.onBar(JD_FIBOv4_27.java:188)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.v.run(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.BN(Unknown Source)
   at com.dukascopy.dds2.greed.actions.servicesources.StrategyTesterAction.Bm(Unknown Source)
   at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)



regards

Author:  vadim_berezhnoj [ Wed 17 Jul, 2013, 13:54 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Tested. Trades OK.

Image

Attachments:
Pic1.png [102.83 KiB]
Downloaded 716 times

Author:  mrlfx [ Fri 19 Jul, 2013, 13:04 ]
Post subject:  Re: Problem with FIBPIVOT strategy

vadim_berezhnoj wrote:
I'll take a look.
Was there any messages in "Message" window while real-time tests?


Hi Vadim,

I too tried to use Pivots in a strategy. I have use the P/R/S lines generated as you explained.
I guess the Pivots are fine and working.

The problem is in multiple opening of positions even with a logic for single position.

File of the sample Pivot strategy is attached.

Following are some of the relevant part of the report of the test.

Opened orders:

Label Amount Direction Open price Profit/Loss at the end Profit/Loss at the end in pips Open date Comment
IVF20130629_02292862843207 0.1 BUY 1.301168 -36.80 -3.7 2013-06-30 21:00:00
IVF20130629_02292864209009 0.1 BUY 1.301168 -36.80 -3.7 2013-06-30 21:00:00
IVF20130629_02292843079304 0.1 BUY 1.301168 -36.80 -3.7 2013-06-30 21:00:00



Closed orders:

Label Amount Direction Open price Close price Profit/Loss Profit/Loss in pips Open date Close date Comment
IVF20130601_05295976921455 0.1 BUY 1.29997 1.2983 -167.0 -16.7 2013-06-02 21:00:00 2013-06-02 21:20:55
IVF20130601_05295978987759 0.1 BUY 1.29997 1.2983 -167.0 -16.7 2013-06-02 21:00:00 2013-06-02 21:20:55
IVF20130601_0529592904798 0.1 BUY 1.29997 1.2983 -167.0 -16.7 2013-06-02 21:00:00 2013-06-02 21:20:55
IVF20130603_03275936046879 0.1 BUY 1.2995 1.30033 83.0 8.3 2013-06-02 21:58:00 2013-06-03 00:54:50
IVF20130603_03275988349794 0.1 BUY 1.2995 1.30033 83.0 8.3 2013-06-02 21:58:00 2013-06-03 00:54:50
IVF20130603_03275914445412 0.1 BUY 1.2995 1.30033 83.0 8.3 2013-06-02 21:58:00 2013-06-03 00:54:50
IVF20130605_05295668276017 0.1 BUY 1.30721 1.30835 114.0 11.4 2013-06-05 00:00:00 2013-06-05 02:23:16
IVF20130606_05495822322479 0.1 BUY 1.3085 1.30765 -85.0 -8.5 2013-06-06 00:20:00 2013-06-06 00:42:48
IVF20130608_02295163562561 0.1 BUY 1.3221 1.31906 -304.0 -30.4 2013-06-09 21:00:00 2013-06-09 21:00:32
IVF20130608_02295170462562 0.1 BUY 1.3221 1.31906 -304.0 -30.4 2013-06-09 21:00:00 2013-06-09 21:00:32




Time Event type Event text
2013-06-02 21:00:00 Order submitted Order [IVF20130601_05295976921455, EUR/USD, BUY, 100000.0 at 0.0] submitted by the strategy
2013-06-02 21:00:00 Order submitted Order [IVF20130601_05295978987759, EUR/USD, BUY, 100000.0 at 0.0] submitted by the strategy
2013-06-02 21:00:00 Order submitted Order [IVF20130601_0529592904798, EUR/USD, BUY, 100000.0 at 0.0] submitted by the strategy
2013-06-02 21:00:00 Order filled Order [IVF20130601_05295976921455, EUR/USD, BUY, 100000.0 at 1.29997] filled
2013-06-02 21:00:00 Order filled Order [IVF20130601_05295978987759, EUR/USD, BUY, 100000.0 at 1.29997] filled
2013-06-02 21:00:00 Order filled Order [IVF20130601_0529592904798, EUR/USD, BUY, 100000.0 at 1.29997] filled
2013-06-02 21:20:55 Order closed Order [IVF20130601_05295976921455, EUR/USD, BUY, 100000.0 at 1.29997] closed by stop loss event, amount 100000.0 at 1.2983
2013-06-02 21:20:55 Order closed Order [IVF20130601_05295978987759, EUR/USD, BUY, 100000.0 at 1.29997] closed by stop loss event, amount 100000.0 at 1.2983
2013-06-02 21:20:55 Order closed Order [IVF20130601_0529592904798, EUR/USD, BUY, 100000.0 at 1.29997] closed by stop loss event, amo


Note: Sorry to intrude in this thread but I guess its relevant to the Pivot issues!

Attachments:
TheLines.vfs [32.71 KiB]
Downloaded 378 times

Author:  vadim_berezhnoj [ Tue 23 Jul, 2013, 17:02 ]
Post subject:  Re: Problem with FIBPIVOT strategy

That happens because on 1 minute chart can be candles with equal high and low. Take a look:

Image

Fix the logic of strategy.

Attachments:
3positions.png [146.42 KiB]
Downloaded 719 times

Author:  mad_max [ Fri 26 Jul, 2013, 10:37 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Hello all.

I try to make strategy based on FIBO in many different ways and in VJF work exactly as programed, but when generate in java, every strategy work much different than in VJF.

I don't know is it about java generator engine or something else!?

Anyway, I don't give up of making strategy based on FIBO because think that kind of trade is very promising in some pairs.

regards

Author:  vadim_berezhnoj [ Fri 26 Jul, 2013, 11:33 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Greetings.

In this post we discussed the alternative way of programming Fib Pivots. Try it.
If you'v faced any problem please provide more details on it, strategy example or printscreens.

Author:  mad_max [ Tue 27 Aug, 2013, 13:10 ]
Post subject:  Re: Problem with FIBPIVOT strategy

Hello.

vacation is over so back to FIBO solutions :lol:

This is modified strategy based of fibo calculation formula as Vadim suggest.
Strategy is started remotely in my demo account but pending positions was rejected because of "Invalid price format - please use increments of 0.1 pip".
This was showing as error in strategy log.
I look in other part of Dukascopy forum and think is something with Rounding prices (I'm not java coder so maybe mistake)
https://www.dukascopy.com/wiki/#Rounding_prices

I don't know is it bug with generating code or not, but please investigate so I can go further.

regards

Attachments:
JD_FIBOv4_274.vfs [56.19 KiB]
Downloaded 374 times

  Page 1 of 1