Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

How to get fibonacci retracement levels in strategy?
 Post subject: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Mon 18 Mar, 2013, 15:32 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Dear Support,

How can I get the fibonacci retracement levels in a strategy?
On a chart I can place the fibonacci retracement by defining a low and a high point. After this I have the values visible on the chart.
Is there a way to get these values in a strategy?
There is the fibPivot indicator available in the API, but it seems to me that it is a bit different. As that indicator calculates values for a given number of candles.
What I want is to give a low and a high price for an indicator (as a parameter), and the resulting array contains the fibonacci retracement level values, just as we can see in a chart.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Tue 19 Mar, 2013, 08:31 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Chart_object_catalog
https://www.dukascopy.com/wiki/#Chart_object_catalog/Fibo_retracements


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Tue 19 Mar, 2013, 09:59 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Thanks for the reply.

Maybe I was not clear enough, as I don`t want to place the chart object from the strategy on the chart. If I am not mistaken, the wiki page that you`ve linked describes how to put the specified object (in this case the fibo retracement) on the chart.
I would like to get the fibo retracement levels (the precise value of the prices at those levels) in the strategy.
Of course, I could calculate the price for those levels, based on the selected low and high price, just I was wondering is it already available in the API. So I don`t have to calculate, just call the function/indicator.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Tue 19 Mar, 2013, 10:36 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The article also shows how you can get the level values (scroll a bit higher from the fibonacci example).
If you wish to use the fibonacci indicator then see:
https://www.dukascopy.com/wiki/#Indicator_Calculation


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Tue 19 Mar, 2013, 13:30 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Oh, thanks. I can see it now...

As it looks a bit overkill (create chart object, and get some parameters from them), I want to stick with the indicator. Which indicator should I use? I was able to find only the fibPivot(), but that`s not the one I need. Or do I overlook something with that one too?


Thanks in advance.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Tue 19 Mar, 2013, 14:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tcsabina wrote:
Which indicator should I use?
Find the suitable one in the platform, and then find the matching indicator in the IIndicators interface.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Wed 20 Mar, 2013, 15:29 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Quote:
Find the suitable one in the platform


Now that`s it. Which one is that?
As the fibo. retracement is not an `indicator` as it is not listed under indicators. Rather it is a tool, which you have to select from the dropdown menu of tools listed in the toolbar. (Which is basically fine, as we don`t need to re-calculate this for every ticks/bars.)

Is there an equivalent function for that tool in the API?
If there isn`t, and the only way to get this tool (and its values) to be available in a strategy is the IFiboRetracementChartObject combined with ILeveledChartObject, would this run perfectly fine if there is no chart available? Let suppose we run the Historical Tester in non-visual mode, and we skip the chart.add() line. Is it safe to use something chart related in a no-chart-available situation?


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Wed 20 Mar, 2013, 16:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
forum rules wrote:
Submit programming questions in this forum only.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Wed 20 Mar, 2013, 16:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tcsabina wrote:
Now that`s it. Which one is that?
We checked with the platform that there is no indicator for fibonacci retracement.
tcsabina wrote:
As the fibo. retracement is not an `indicator` as it is not listed under indicators.
Obviously, the chart object that you refer to is not an indicator.
tcsabina wrote:
Rather it is a tool, which you have to select from the dropdown menu of tools listed in the toolbar. (Which is basically fine, as we don`t need to re-calculate this for every ticks/bars.)
From the API perspective it's an IChartObject.
tcsabina wrote:
Is there an equivalent function for that tool in the API?
If there isn`t, and the only way to get this tool (and its values) to be available in a strategy is the IFiboRetracementChartObject combined with ILeveledChartObject, would this run perfectly fine if there is no chart available? Let suppose we run the Historical Tester in non-visual mode, and we skip the chart.add() line. Is it safe to use something chart related in a no-chart-available situation?
Of course you can't use chart objects if there is no chart opened.


 
 Post subject: Re: How to get fibonacci retracement levels in strategy? Post rating: 0   Post Posted: Thu 21 Mar, 2013, 10:42 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Thank you for the detailed answers.

As a follow up, I made a new feature request: viewtopic.php?f=83&t=48973


 

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