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.

T3 and butterwort Code source Please
 Post subject: T3 and butterwort Code source Please Post rating: 0   New post Posted: Sun 13 May, 2012, 02:45 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Dear Support, thank you for all your fantastique work,

Please, could you provide us the source code of the indicator T3 and butterwort ?

Also, those 2 indicator provide a value at the end of there calculation, please could you provide us 2 indicators :
reverse_t3 and reverse_butterwort; which the objectives will be to reverse calculate the value of the fisrt original to the actual applied price.

eg: Price = x
T3(x) = y
so
reverse_t3(y) = Price

{The same apply to butterwort}

I would like to work deep in physic and statistic on chart

THANK YOU SO MUCH


{I decide to drop ml4 this week in favor to jForex; your software/framwork is fantastic !}


 
 Post subject: Re: T3 and butterwort Code source Please Post rating: 0   New post Posted: Mon 14 May, 2012, 10:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please download standalone JForex API from https://www.dukascopy.com/swiss/english/forex/api/jforex_api/
Unzip JForex-API-2.6.66-sources.jar from lib folder. ButterworthFilterIndicator.java is located in com/dukascopy/indicators.
The source for T3 is available from https://ta-lib.org/hdr_dw.html


 
 Post subject: Re: T3 and butterwort Code source Please Post rating: 0   New post Posted: Tue 15 May, 2012, 06:03 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
Thank you for your reply support !!

This will help me a lot.

Please, I would like to ask again : May you provide us a formula or a indicator in order to reverse the calculation of the t3 result or of the butterwort result ?

For example if t3(price) = x; this function will be able f(x) = price ?


Thanks ! the last couple of day, I was transfering my strategy on jForex, and I am serioulsy planning to open an live account soon !

Thanks again


 
 Post subject: Re: T3 and butterwort Code source Please Post rating: 0   New post Posted: Tue 15 May, 2012, 09:20 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
see:
https://ta-lib.svn.sourceforge.net/viewvc/ta-lib/trunk/ta-lib/c/src/ta_func/ta_T3.c?revision=1533&view=markup


 
 Post subject: Re: T3 and butterwort Code source Please Post rating: 0   New post Posted: Tue 15 May, 2012, 23:31 
User avatar

User rating: 0
Joined: Thu 10 May, 2012, 03:57
Posts: 13
Location: MozambiqueMozambique
API Support wrote:


Hi , Thank you for your help support. This is great ressource

But unfortunatly, I really dont find nothing appliable in a jForex strategy, that could help me to reverse t3 result.

Please could you provide us an example inside of an JX straregy ?

Best regards

Thank you !


 
 Post subject: Re: T3 and butterwort Code source Please Post rating: 0   New post Posted: Wed 16 May, 2012, 10:30 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Actually you don't need to reverse it, since you can get the price value from the candle stick bar feed. Try the following strategy with 10 sec Eur/Usd candle stick bid chart:
package jforex.strategies.indicators;


import com.dukascopy.api.*;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.drawings.IOhlcChartObject;
import com.dukascopy.api.indicators.IIndicator;

public class AddToChartT3 implements IStrategy {
    private IIndicators indicators;
    private IChart chart;
    private IConsole console;
    private IOhlcChartObject ohlc = null;
   
    @Configurable("")
    public Filter filter = Filter.NO_FILTER;
    @Configurable("")
    public Instrument instrument = Instrument.EURUSD;
    @Configurable("")
    public Period period = Period.TEN_SECS;
    @Configurable("")
    public OfferSide side = OfferSide.BID;
    @Configurable("")
    public AppliedPrice appliedPrice = AppliedPrice.CLOSE;
    @Configurable("")
    public int t3TimePeriod = 5;
    @Configurable("")
    public double t3VFactor = 0.7;
    @Configurable("")
    public boolean addToChart = true;
   

    public void onStart(IContext context) throws JFException {
        this.indicators = context.getIndicators();
        this.chart = context.getChart(Instrument.EURUSD);
        this.console = context.getConsole();
       
        if(addToChart){
            IIndicator indicator = indicators.getIndicator("T3");
            Object[] optInputs = new Object[]{t3TimePeriod, t3VFactor};
            chart = context.getChart(instrument);
            addToChart(chart, indicator, optInputs);
        } 
    }
   
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { 
        if(period != this.period || instrument != this.instrument){
            return;
        }
       
        double prevT3 = indicators.t3(instrument, period, side, appliedPrice, t3TimePeriod, t3VFactor, 1);
        IBar bar = side == OfferSide.BID ? bidBar : askBar;
        double price = getPrice(bar, appliedPrice);
        print("T3=%.5f, price=%.5f, bar=%s", prevT3, price, bar);
    }
   
    private double getPrice(IBar bar, AppliedPrice appliedPrice){
        switch (appliedPrice) {
        case CLOSE:
            return bar.getClose();
        case HIGH:
            return bar.getHigh();
        case LOW:
            return bar.getLow();
        case OPEN:
            return bar.getOpen();
        case MEDIAN_PRICE:
            return (bar.getHigh() + bar.getLow()) / 2d;
        case TYPICAL_PRICE:
            return (bar.getHigh() + bar.getLow() + bar.getClose()) / 3d;
        case WEIGHTED_CLOSE:
            return (bar.getHigh() + bar.getLow() + bar.getClose() + bar.getOpen()) / 4d;
        case TIMESTAMP:
            return bar.getTime();
        case VOLUME:
            return bar.getVolume();
        }   
        return 0d;
    }
   
    private void addToChart(IChart chart, IIndicator indicator, Object[] optInputs){
        if(chart == null){
            print("Won't plot indicator on chart. Chart not opened!");   
            return;
        }
        if (chart.getSelectedOfferSide() != this.side) {
            print("Won't plot indicator on chart. Chart offer side is not " + this.side);
            return;
        } 
        if (chart.getSelectedPeriod() != this.period) {
            print("Won't plot indicator on chart. Chart period is not " + this.period);
            return;
        }         

        chart.addIndicator(indicator, optInputs);
       
        for (IChartObject obj : chart.getAll()) {
            if (obj instanceof IOhlcChartObject) {
                ohlc = (IOhlcChartObject) obj;
            }
        }
        if (ohlc == null) {
            ohlc = chart.getChartObjectFactory().createOhlcInformer();
            chart.addToMainChart(ohlc);
        }
        ohlc.setShowIndicatorInfo(true);
    }
   
    private void print(String format, Object...args){
        print(String.format(format, args));
    }

    private void print(Object message) {
        console.getOut().println(message);
    }

    public void onAccount(IAccount account) throws JFException {    }
    public void onMessage(IMessage message) throws JFException {    }
    public void onStop() throws JFException {    }
    public void onTick(Instrument instrument, ITick tick) throws JFException {    }

}



Attachments:
AddToChartT3.java [4.13 KiB]
Downloaded 280 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.
 

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