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.

My OfferSide Mod
 Post subject: My OfferSide Mod Post rating: 0   New post Posted: Mon 08 Aug, 2011, 17:57 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
Hi all, need help^

...
OfferSide priceTypical = price_typical();
iCCI_Signal = indicators.cci(instrument, Period.FIFTEEN_MINS, priceTypical, period, 1);
...

    //+--------------------------------------------------------------------------------------------------------------+
    //| price_typical. Аналог PRICE_TYPICAL для индикатора CCI.
    //+--------------------------------------------------------------------------------------------------------------+
    public OfferSide price_typical () throws JFException {
    //+--------------------------------------------------------------------------------------------------------------+
       
        OfferSide newprice = (high(1, OfferSide.BID, Period.FIFTEEN_MINS)+low(1, OfferSide.BID, Period.FIFTEEN_MINS)+close(1, OfferSide.BID, Period.FIFTEEN_MINS))/3;
       
        return newprice;
    }

... Staff...

    //+--------------------------------------------------------------------------------------------------------------+
    //| low. Массив-таймсерия, содержащий минимальные цены каждого бара текущего графика.
    //+--------------------------------------------------------------------------------------------------------------+
    public double low(int index, OfferSide side, Period period) throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+
   
        return history.getBar(instrument, period, side, index).getLow();
    }

    //+--------------------------------------------------------------------------------------------------------------+
    //| high. Массив-таймсерия, содержащий максимальные цены каждого бара текущего графика.
    //+--------------------------------------------------------------------------------------------------------------+
    public double high(int index, OfferSide side, Period period) throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+
   
        return history.getBar(instrument, period, side, index).getHigh();
    }

    //+--------------------------------------------------------------------------------------------------------------+
    //| close. Массив-таймсерия, содержащий цены закрытия каждого бара текущего графика.
    //+--------------------------------------------------------------------------------------------------------------+
    public double close(int index, OfferSide side, Period period) throws JFException{
    //+--------------------------------------------------------------------------------------------------------------+
   
        return history.getBar(instrument, period, side, index).getClose();
    }



If a try docompile EA, Jforex send message - Type mismatch: cannot convert from double to OfferSide

How are fixed this problem?

Thanks for help!


 
 Post subject: Re: My OfferSide Mod Post rating: 0   New post Posted: Tue 09 Aug, 2011, 07:38 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
At line 12 you assign a double value to an OfferSide variable. Consider using some IDE (e.g. Eclipse) to assist you on such errors:
https://www.dukascopy.com/swiss/english/ ... x/library/


 
 Post subject: Re: My OfferSide Mod Post rating: 0   New post Posted: Tue 09 Aug, 2011, 11:02 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
I now there error in my code.

How convert double to OfferSide, or why realize price_typical function?


 
 Post subject: Re: My OfferSide Mod Post rating: 0   New post Posted: Tue 09 Aug, 2011, 11:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
You don't need to calculate the typical price, the indicator does it for you. That is just make the indicator call in the following way:
iCCI_Signal = indicators.cci(instrument, Period.FIFTEEN_MINS,  IIndicators.AppliedPrice.TYPICAL_PRICE, period, 1);


 
 Post subject: Re: My OfferSide Mod Post rating: 0   New post Posted: Tue 09 Aug, 2011, 17:17 

User rating: 0
Joined: Sat 06 Aug, 2011, 23:17
Posts: 27
Location: Russian Federation,
In https://www.dukascopy.com/client/javadoc ... ,%20int%29 It is impossible to use AppliedPrice.* for CCI

double cci(Instrument instrument, Period period, OfferSide side, int timePeriod, int shift)

AppliedPrice.* use for indicator ma - https://www.dukascopy.com/client/javadoc ... ,%20int%29 , not for CCI

If i try decompile iCCI_Signal = indicators.cci(instrument, Period.FIFTEEN_MINS, IIndicators.AppliedPrice.TYPICAL_PRICE, period, 1);

send message

16:11:38 The method cci(Instrument, Period, OfferSide, int, int) in the type IIndicators is not applicable for the arguments (Instrument, Period, IIndicators.AppliedPrice, int, int)


 
 Post subject: Re: My OfferSide Mod Post rating: 0   New post Posted: Wed 10 Aug, 2011, 07:22 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Pardon, the right function call is:
iCCI_Signal = indicators.cci(instrument, Period.FIFTEEN_MINS,  OfferSide.BID, period, 1);
We reiterate that the typical price calculation gets carried out in the indicator itself so you don't need to pass this value to it.


 

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