Dukascopy
 
 
Wiki JStore Search Login

Different ATR readings in VJF and JF
 Post subject: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Tue 02 Feb, 2016, 12:05 
User avatar

User rating: 1
Joined: Wed 20 Jan, 2016, 08:45
Posts: 15
Location: Belarus,
Hello,

Can you please help me with the following:

There's a divergence between ATR readings in Visual JF and the indicator itself.
In my strategy the Stop-Loss is based on ATR. The size of SL should be three ATRs = ATR*3.
However when I run the strategy in Historical Tester, the test produces SL size somewhat smaller than the ATR indicator (multiplied by 3).

Quick search on the forum shows that ATR do differ, maybe due to different methods of calculation. Search result 1, search result 2.

Here are the images to make things clear. Also see the strategy file VFS attached.

Image

Image

Image

ATR calculated manually also differs from what the tester produces:

Image

If there is my mistake, could you please help correct it?

Thank you.


Attachments:
ATRs_differ_question_to_forum.vfs [45.16 KiB]
Downloaded 189 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: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Tue 02 Feb, 2016, 16:33 
Visual JForex expert at Dukascopy
User avatar

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

Thanks for the detailed description.
We do have an outstanding issue that may impact the result of your tests but I'm not 100% sure of that. I made some slight modifications to the strategy, can please double check its results and let me know ?

Thanks


Attachments:
ATRs_differ_question_to_forum_V1.vfs [46.83 KiB]
Downloaded 198 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: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Wed 03 Feb, 2016, 07:48 
User avatar

User rating: 1
Joined: Wed 20 Jan, 2016, 08:45
Posts: 15
Location: Belarus,
Hi, Amine,

Thank you for quick reply and the adjustment to the system, the Shift 1 in ATR did help.

Here are some images.

Image

Image

One last question left:
It turns out, that if you don't make a shift in ATR, the system will use the ATR reading from the current candle that is being formed now?


 
 Post subject: Re: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Fri 05 Feb, 2016, 15:02 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Quote:
It turns out, that if you don't make a shift in ATR, the system will use the ATR reading from the current candle that is being formed now?


This is absolutely correct, t he ATR with shift 0 means a calculation based on the current candle being formed and as this current candle's attributes are not yet defined (Close price, High and low) the ATR is fluctuating till the final value is set till the candle's expires. This is an essential concept if programming using Visual Jforex as well as Jforex API (Java).
If the use of the current ATR is mandatory for you, you can refine the calculation mode of the indicator by changing the way this calculation is made: Instead of close price which is more sensitive you can use the median price. You can find the calculation parameters in the block's setting settings.

Cheers


 
 Post subject: Re: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Sun 07 Feb, 2016, 15:22 
User avatar

User rating: 1
Joined: Wed 20 Jan, 2016, 08:45
Posts: 15
Location: Belarus,
Thank you, Amine.

So, this may be a rookie question, but still:

1) Here - do we have a value that is fluctuating? (because the SMA shit is zero)

Image

2) And here - do we have a value that is fixed? (last candle of default period)

Image

3) And here we have fixed values of last candle of default period.

Image

Are those correct?

Thank you.


 
 Post subject: Re: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Mon 08 Feb, 2016, 15:32 
Visual JForex expert at Dukascopy
User avatar

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

I'll try to bring more light on this:

Quote:
1) Here - do we have a value that is fluctuating? (because the SMA shit is zero)

SMA shift is 0 --> SMA value corresponds to the current fluctuating value that will remain moving till the candle is finished BUT this depends on how your indicator is plugged and what condition(s) is (are) implemented before it:
Example1 :

Image
you have an ema plugged with a period filter that will allow the flow to go IF the period is = to One minute. In other words, any conditions or block that sits after this will be checked-executed every minute. In this case, with your EMA shift 0 one the very first tick of the new 1mn candle starts, the output of the EMA will correspond to the current value of the indicator at the open price of the candle (the very first tick) So the current value of the EMA is the one been "catch" when the candle starts.

Example 2:


Image

This is an EMA plugged straight to the OnCandle start point which by the way will be executed at any candle period starting from the minimum one (10sec) till the maximum (Month).
So every 10 sec, the system will proceed and the flow will go through the EMA block and the output will show the value of the current EMA every 10 sec. SO it is a kind of snapshot every 10 sec of the fluctuating value of the EMA built on 1 mn period.

Many other examples can be configured such as a filter of 1 mn plugged to an EMA with period of 15mn for instance. this will optimize the system checks if you need frequent verification of the current EMA value, so basically you'll get the current snapshot of the EMA built on 15mn candles every 1mn of time.

Quote:
2) And here - do we have a value that is fixed? (last candle of default period)


As long as the shift value is 1 and greater, we are looking to a past value of the indicator which is already calculated and defined upon the period selected. The value is then fixed and ready to be used or called for any-further condition. You can still check this past value in a chart with the same indicator drawn.
Quote:
3) And here we have fixed values of last candle of default period.


No same as 1, these are the current candle's OHLC which still moving except the Open price which already determined when the candle starts. You can play with these variables by changing the default period applied and drag them into the work-space a conduct a real time run. You'll see the High, low and close price moving.

Hope this helps ..

A


Attachments:
EMA_NotFiltered.JPG [64.71 KiB]
Downloaded 374 times
EMA_filtered.JPG [92.16 KiB]
Downloaded 313 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: Different ATR readings in VJF and JF Post rating: 0   New post Posted: Mon 08 Feb, 2016, 18:13 
User avatar

User rating: 1
Joined: Wed 20 Jan, 2016, 08:45
Posts: 15
Location: Belarus,
Wow, this helps so much, thank you, Amine, that's great!


 

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