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.

Basic Question about The Indicator
 Post subject: Basic Question about The Indicator Post rating: 0   New post Posted: Fri 13 Jan, 2012, 20:28 

User rating: 0
Joined: Fri 13 Jan, 2012, 20:17
Posts: 1
Dear all Forex Gurus,

I have a very simple question about the default indicator provided by the dukascopy. Here is a indicator called TVS (Time Segment Value) which is kind of volume price mixed indicator. Since here is no real volume in forex trading. I just want to know the EXACT defination of this indicator for understanding and rewritting based on the code from Dukascopy as well.

Dukascopy Forum Manager, or any other Java Gurus, may you tell me where I could find the defination of the all default indicators??

Thanks in advance


 
 Post subject: Re: Basic Question about The Indicator Post rating: 0   New post Posted: Mon 16 Jan, 2012, 14:00 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
shewenhao wrote:
may you tell me where I could find the defination of the all default indicators??
Indicator source codes are published in Standalone JForex-API. Find there also TVS indicator. Part of indicators are described in JForex wiki Indicator catalog, usage of indicators from strategies can be found here.
shewenhao wrote:
I just want to know the EXACT defination of this indicator for understanding and rewritting based on the code from Dukascopy as well.
Regarding the TVS algorithm, see comments we added to the calculate method of the indicator:
    public IndicatorResult calculate(int startIndex, int endIndex) {
        //calculating startIndex taking into account lookback value
        if (startIndex - getLookback() < 0) {
            startIndex -= startIndex - getLookback();
        }
        if (startIndex > endIndex) {
            return new IndicatorResult(0, 0);
        }

        //multPrice
        int resIndex = 0;

        for (int z = startIndex; z <= endIndex; z++, resIndex++) {
            double sum = 0;
            //accumulate values over the lookback (i.e. Time Period) period
            for (int i = resIndex; i < (resIndex + getLookback()); i++) {
                double tmp = 0;
                if (i != resIndex) {
                    //Inputs: 0 open, 1 close, 2 high, 3 low, 4 volume
                   //green bar - close price higher than previous one
                    if  (inputs[0][1][i] > inputs[0][1][i - 1]) {
                       //volume * green bar height
                        tmp = inputs[0][4][i] * (inputs[0][1][i] - inputs[0][1][i - 1]);
                    //red bar - close price lower than previous one
                    } else if (inputs[0][1][i] < inputs[0][1][i - 1]) {
                       //volume * red bar height
                        tmp = (-1) * inputs[0][4][i] * (-inputs[0][1][i] + inputs[0][1][i - 1]);
                    //flat bar - close prices are equal
                    }   else {
                        tmp = 0;
                    }
                }
                //accumulate
                sum = sum + tmp;
            }
            //assign output
            outputs[0][resIndex] = sum;
        }
        return new IndicatorResult(startIndex, resIndex);
    }
Thus the result of indicator value is an accumulated multiplications of volumes and bar sizes over the given time period.
For more on indicators see JForex wiki: https://www.dukascopy.com/wiki/#Indicator_API:_Overview


 

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