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.

How to save templates?
 Post subject: How to save templates? Post rating: 0   Post Posted: Fri 24 Dec, 2010, 19:22 

User rating: 0
Joined: Fri 24 Dec, 2010, 18:45
Posts: 1
I have difficulty in the English language, forgive me the errors.


For two years I've been studying the Forex market, but only on MT4 platform.

I have doubts: :?:

How do I save a template with my indicators and can open them in any currency pair.

There is the possibility of program opening pending orders only after the candle was being closes his time in the chosen time frame (H15/H1/H4/D1) to reach the Buy Stop or Sell Stop

Thanks


 
 Post subject: Re: How to save templates? Post rating: 0   Post Posted: Tue 28 Dec, 2010, 10:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
To submit a buy stop order please use the OrderCommand.BUYSTOP in the submitOrder method. If you want to submit order after certain bar is completed, please use the onBar method with filters. Please consider the following code to submit the stop buy stop order:
    private double stopLossPrice;
    private double takeProfitPrice;
    private double stopPrice = 1.3230;
    private double lot = 0.01;
    public void onBar(Instrument instrument, Period period, IBar askbar, IBar bidbar) throws JFException {
       if (instrument.equals(Instrument.EURUSD) && (period.equals(Period.FIFTEEN_MINS)  || period.equals(Period.ONE_HOUR) ||  period.equals(Period.FOUR_HOURS)
             ||  period.equals(Period.DAILY)) ) {
         stopLossPrice = stopPrice - (5 * instrument.getPipValue());
         takeProfitPrice = stopPrice + (20 * instrument.getPipValue());
         engine.submitOrder("StopOrder1", instrument, OrderCommand.BUYSTOP, lot, stopPrice, 0,  stopLossPrice, takeProfitPrice);
       }
    }

Please take a look at the following JForex Wiki page for details how to filter bars: https://www.dukascopy.com/wiki/index.php ... Ticks/Bars. For details about submitting conditional order, please consider the following JForex Wiki: https://www.dukascopy.com/wiki/index.php ... onal_Order


 

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