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

Visual JForex vs Java source code
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=141&t=50506
Page 1 of 1

Author:  Heruar [ Wed 11 Dec, 2013, 17:26 ]
Post subject:  Visual JForex vs Java source code

Hello Support ,

I have a question about the code behind the Visual JForex.
In my strategy I noticed the following:

IBar bidBar = context.getHistory().getBar(defaultInstrument, Period.ONE_MIN, OfferSide.BID, 1);
IBar askBar = context.getHistory().getBar(defaultInstrument, Period.ONE_MIN, OfferSide.ASK, 1);
LastAskCandle = new Candle(askBar, Period.ONE_MIN, defaultInstrument, OfferSide.ASK);
LastBidCandle = new Candle(bidBar, Period.ONE_MIN, defaultInstrument, OfferSide.BID);

Although the strategy is built in Visual JForex and has no reference to ONE_MIN period, why is this used here ?
My understanding of Java code is limited to a beginner's course I took 9 months ago :)
Shouldn't it be TEN_MIN like I specified in the defaultPeriod ?
I attached the visual strategy along with the Java code behind it.
Maybe someone more experienced than me can shed some light.
Thank you.

Cheers

Attachments:
Heruar.vfs [31.14 KiB]
Downloaded 295 times
Heruar.java [18.98 KiB]
Downloaded 308 times

Author:  Heruar [ Tue 17 Dec, 2013, 16:30 ]
Post subject:  Re: Visual JForex vs Java source code

Nobody cares to answer this ?
...

Author:  Visual Support [ Thu 19 Dec, 2013, 10:16 ]
Post subject:  Re: Visual JForex vs Java source code

Hello

I dont see any problem, due that

IBar bidBar
IBar askBar
LastAskCandle
LastBidCandle


has One_Minute period in moment of strategy initialization, later they will be set to the defaultPeriod.
But, even in case of initial values, will be more nice to use defaultPeriod and it will be fixed in next version.

Author:  Heruar [ Thu 19 Dec, 2013, 17:12 ]
Post subject:  Re: Visual JForex vs Java source code

Hello Support !

First off, THANK YOU for the reply on my birthday :)

Now, the reason I wrote to you is because my strategy doesn't work as intended. There are some very weird decisions it makes and those decisions don't reflect the code.
Could you please tell me what getPeriod() does ? I searched everywhere in the API library and couldn't find it.
I'm trying to figure out why my strategy doesn't respect the conditions set for opening positions.

Thank you

Author:  vadim_berezhnoj [ Mon 23 Dec, 2013, 15:05 ]
Post subject:  Re: Visual JForex vs Java source code

Greetings.

According to reply of Visual Support problem is not in Java code.
Can you specify what strategy is intended to do, then we can identify where the problem comes from.

P.S. In the second TVS block Shift1 is set = 2, that can be a confusion.

Best regards, Support team.

Author:  Heruar [ Thu 26 Dec, 2013, 09:25 ]
Post subject:  Re: Visual JForex vs Java source code

Hi Vadim ,

Thank you for the reply.
My strategy has a few simple conditions:

- 3 indicators that all work on 10 minute candles for 12 candle time periods: sma, ema and tvs
- there are 2 TVS (time segmented volume) variables, one for current candle and one for 2 candles back (hence the shift1 = 2, value)
- the conditions are: sma > ema, tvs1 (current candle) > tvs2 (2 candles back) and both tvs's > 0 --> Sell , and for buy is the exact opposite.

My problem is with the TVS indicators: the rules are not working right. I get orders without these conditions being met.
I attached the strategy to have a look again.
Thank you.

Cheers

Attachments:
Heruar.vfs [31.14 KiB]
Downloaded 276 times

Author:  vadim_berezhnoj [ Mon 30 Dec, 2013, 17:04 ]
Post subject:  Re: Visual JForex vs Java source code

Heruar wrote:
My problem is with the TVS indicators: the rules are not working right. I get orders without these conditions being met.


Pictures from VJ tester would be helpful to understand the situation.

Author:  Heruar [ Sat 04 Jan, 2014, 12:47 ]
Post subject:  Re: Visual JForex vs Java source code

Hi Vadim ,

I attached a picture from my strategy contest account to showcase what I mean.
If you look at my previous post and check the conditions you'll see that the TVS2 is above 0 and TVS1 is below 0, in the picture.
Waiting for your input on the matter.

Cheers


Image

Attachments:
TVS error.jpg [388.86 KiB]
Downloaded 541 times

Author:  vadim_berezhnoj [ Mon 06 Jan, 2014, 12:21 ]
Post subject:  Re: Visual JForex vs Java source code

Your strategy recalculates TVS on every period candle close.
Just add IF block to filter only 10 min candle closes.

Author:  Heruar [ Sun 12 Jan, 2014, 10:52 ]
Post subject:  Re: Visual JForex vs Java source code

Hi Vadim ,

Sorry for the late reply. I didn't have much time to play with my strategy lately.
Anyway, here's the result:
I added a filter for 10 minute candles and it does nothing. I get the same bad decisions.
I attached a screen from the historical tester to showcase the problem.
The red line is SMA(12) and the blue one is EMA(12). Check out the TVS on the bottom. It's not anywhere near to what it should do.
What is wrong with the strategy ? Or is it the TVS the problem ?
Awaiting your knowledgeable advice :)
Thank you.

PS: It seems I can't attach anything due to a server error. I'll get back later with the screenshot and the strategy file.

Author:  Heruar [ Mon 13 Jan, 2014, 17:13 ]
Post subject:  Re: Visual JForex vs Java source code

Finally, server is working...


Image

Attachments:
Heruar.vfs [32.44 KiB]
Downloaded 244 times
TVS error 2.jpg [376.34 KiB]
Downloaded 509 times

Author:  Heruar [ Thu 30 Jan, 2014, 06:12 ]
Post subject:  Re: Visual JForex vs Java source code

Any news on this ?
Is it a bug, is it being fixed ?
Thanks.

Cheers

  Page 1 of 1