|
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.
code for indicator |
maxi
|
Post subject: code for indicator |
Post rating: 0
|
Posted: Thu 21 Feb, 2013, 19:05
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
Hello support. please help with this ind: viewtopic.php?f=6&t=47900this is the correct spelling? Object[] trima = indicators.calculateIndicator(instrument,Period.ONE_HOUR, new OfferSide[] {OfferSide.BID},"TRIMA_BANDS_2",new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE},new Object[]{56,100,2}, 1); double trima_high = (Double)trima[0]; double trima_zerro=(Double)trima[1]; double trima_low=(Double)trima[2]; I'm add this code to strategy, but: strategy not work. please help. Thank You
|
|
|
|
 |
API Support
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 10:08
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide full example strategy and the indicator that you use.
|
|
|
|
 |
maxi
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 10:22
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: Please provide full example strategy and the indicator that you use. hi support, strategy works well with any indicators. but question about this indicator.. I get the data correct? Object[] trima = indicators.calculateIndicator(instrument,Period.ONE_HOUR, new OfferSide[] {OfferSide.BID},"TRIMA_BANDS_2",new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE},new Object[]{56,100,2}, 1); double trima_high = (Double)trima[0]; double trima_zerro=(Double)trima[1]; double trima_low=(Double)trima[2]; because I need for use, example: if ( bar.getClose() > trima_high){ or if ( MA > trima_high ){ and have strategy stop after this signals. please advise. thank You for help.
|
|
|
|
 |
API Support
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 10:26
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Please provide full example strategy and the indicator that you use.
|
|
|
|
 |
maxi
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 10:37
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: Please provide full example strategy and the indicator that you use. please see this strategy : viewtopic.php?f=7&t=47492
|
|
|
|
 |
API Support
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 11:19
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
The strategy does not contain the snippet that you posted. Please post the example strategy and the indicator you require the assistance on.
|
|
|
|
 |
maxi
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 11:49
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: The strategy does not contain the snippet that you posted. Please post the example strategy and the indicator you require the assistance on. I can use any strategies with this indicator ? You can use this strategy for example: viewtopic.php?f=7&t=47317My questions about indicator code, boolean sellSign = false; boolean buySign = false; IBar bar = history.getBar(instrument, selectedPeriod, offerSide, 1); Object[] trima = indicators.calculateIndicator(instrument,Period.ONE_HOUR, new OfferSide[] {OfferSide.BID},"TRIMA_BANDS_2",new IIndicators.AppliedPrice[]{IIndicators.AppliedPrice.CLOSE},new Object[]{56,100,2}, 1); double trima_high = (Double)trima[0]; double trima_zerro=(Double)trima[1]; double trima_low=(Double)trima[2]; because I need for use, this signals: if (bar.getClose() > trima_high) { buySign = true; } if (bar.getClose() < trima_low) { sellSign = true; } I need correct work with this signals Please help.
|
|
|
|
 |
maxi
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 14:21
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: The strategy does not contain the snippet that you posted. Please post the example strategy and the indicator you require the assistance on. please see this code:
Attachments: |
TrimaStrat.java [20.69 KiB]
Downloaded 298 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.
|
|
|
|
|
 |
API Support
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 16:53
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
You need to register the indicator in the onStart, for instance: indicators.registerCustomIndicator(new File("C:\\temp\\TRIMA_Bands_Ind_2.jfx"));
The indicator has two input arrays, hence you need to use two AppliedPrices and two OfferSides: Object[] trima = indicators.calculateIndicator(instrument, selectedPeriod, new OfferSide[] { OfferSide.BID, OfferSide.BID }, "TRIMA_BANDS_2", new IIndicators.AppliedPrice[] { IIndicators.AppliedPrice.CLOSE, IIndicators.AppliedPrice.CLOSE }, new Object[] { 56, 100, 2.0 }, 1); double trima_high = (Double) trima[0]; double trima_zerro = (Double) trima[1]; double trima_low = (Double) trima[2];
|
|
|
|
 |
maxi
|
Post subject: Re: code for indicator |
Post rating: 0
|
Posted: Fri 22 Feb, 2013, 18:06
|
|
User rating: 0
Joined: Thu 03 Nov, 2011, 21:46 Posts: 68 Location: Russian Federation,
|
API Support wrote: You need to register the indicator in the onStart, for instance: indicators.registerCustomIndicator(new File("C:\\temp\\TRIMA_Bands_Ind_2.jfx"));
The indicator has two input arrays, hence you need to use two AppliedPrices and two OfferSides: Object[] trima = indicators.calculateIndicator(instrument, selectedPeriod, new OfferSide[] { OfferSide.BID, OfferSide.BID }, "TRIMA_BANDS_2", new IIndicators.AppliedPrice[] { IIndicators.AppliedPrice.CLOSE, IIndicators.AppliedPrice.CLOSE }, new Object[] { 56, 100, 2.0 }, 1); double trima_high = (Double) trima[0]; double trima_zerro = (Double) trima[1]; double trima_low = (Double) trima[2];
Thank You so much
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|