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.

fibPivot making by manual
 Post subject: fibPivot making by manual Post rating: 0   New post Posted: Sat 09 Apr, 2011, 14:04 

User rating: 0
Joined: Sun 20 Feb, 2011, 21:34
Posts: 10
Hi,all.

I'm trying to make strategy related with fibonacci pivot.
In it, I calculate lines by manual.
But they didn't work as fibPivot in api.
My input error?

They are...
IBar pBar = history.getBar(this.instrument,this.testPeriod,OfferSide.BID,1);
double H = pBar.getHigh();
double L = pBar.getLow();
double C = pBar.getClose();

double Pivot = ( H + L + C ) / 3;
double R3 = Pivot + 1.000 * (H - L);
double R2 = Pivot + 0.618 * (H - L);
double R1 = Pivot + 0.382 * (H - L);
double S1 = Pivot - 0.382 * (H - L);
double S2 = Pivot - 0.618 * (H - L);
double S3 = Pivot - 1.000 * (H - L);
Please try to make it by manual.
Maybe its not works as fibPivot in api. :roll: :roll: :roll:
Can I make it by manual?
What's I mistaked?

Thank you.
I hope your reply.


 
 Post subject: Re: fibPivot making by manual Post rating: 0   New post Posted: Sun 10 Apr, 2011, 03:59 

User rating: 0
Joined: Sun 20 Feb, 2011, 21:34
Posts: 10
Adding.

I tried use IIndicators, but fibonacci pivot didn't work as I think.
Do I need to use class Bigdecimal?
Why I can't calc fibonacci pivot lines? & quoting it?

I need your help.
Thank you. :roll: :roll: :roll:


 
 Post subject: Re: fibPivot making by manual Post rating: 0   New post Posted: Wed 13 Apr, 2011, 09:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Please have a look at the following code:
IBar pBar = history.getBar(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.BID, 2); //Fetching a bar of the prior trading period
double H = pBar.getHigh();
double L = pBar.getLow();
double C = pBar.getClose();

double Pivot = ( H + L + C ) / 3;
           
double R1 = Pivot + 0.382 * (H - L);
double R2 = Pivot + 0.618 * (H - L);
double R3 = Pivot + (H - L);           
           
double S1 = Pivot - 0.382 * (H - L);
double S2 = Pivot - 0.618 * (H - L);
double S3 = Pivot - (H - L);       

console.getOut().println("P: " + Pivot + ", R1: " + R1 + ", " + "S1: " + S1 + ", " + 
                  "R2: " + R2 + ", " +  "S2: " + S2 + ", " +  "R3: " + R3 + ", " +  "S3: " + S3);
           
double[] fibpivotSimple =  indicators.fibPivot(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.BID, 5, 1);     //5 = Period.ONE_HOUR   
console.getOut().println("P: " + fibpivotSimple[0] + ", R1: "
                  + fibpivotSimple[1] + ", S1: " + fibpivotSimple[2] + ", R2: " + fibpivotSimple[3] + ", S2: " + fibpivotSimple[4] +
                  ", R3: " + fibpivotSimple[5] + ", S3: " + fibpivotSimple[6]);


 

Jump to:  

cron
  © 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