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.

Question about SAR indicator
 Post subject: Question about SAR indicator Post rating: 0   New post Posted: Wed 18 Nov, 2009, 20:40 

User rating: -
I set up a script to display the SAR but it doesn't return the value I'd expect from looking at the charts. Shouldn't the SAR indicator return what is displayed? Or am I missing something here?

Any help is appreciated!


 
 Post subject: Re: Question about SAR indicator Post rating: 0   New post Posted: Thu 19 Nov, 2009, 09:28 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
yes, you are correct, a SAR indicator as well as other indicators returns the same info that is shown in charts.
Please consider this example
package jforex;

import com.dukascopy.api.*;

public class TestSAR implements IStrategy {
    private IConsole console;
    private IIndicators indicators;
   
    public void onStart(IContext context) throws JFException {
        this.console = context.getConsole();
        this.indicators = context.getIndicators();
    }
    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 {
        console.getOut().println(indicators.sar(Instrument.EURUSD, Period.TEN_SECS, OfferSide.BID, 0.02, 0.2, 2));
    }

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
    }
}


 

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