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.

Activating trailing upon the creation of an order
 Post subject: Activating trailing upon the creation of an order Post rating: 0   New post Posted: Tue 07 Jun, 2011, 21:41 

User rating: -
Hey guys :)

i am currently writing a strategy, but i cannot find a way to include trailing in my orders.
On the wiki it gives concrete examples with an explanation for the modification of an existing order.
For the creation of the order it only gives the following without explaining the parameters:

engine.submitOrder("order", Instrument.EURUSD, OrderCommand.BUY, 0.001, 0, 20, 1.2222, 0);


I have tried to put in a "10" for every numeric value in the code, but i can't seem to be successful.
I would very much appreciate an explanation of the numeric values in the above code. Been trying all evening :(

Thanks in advance guys :)


 
 Post subject: Re: Activating trailing upon the creation of an order Post rating: 0   New post Posted: Wed 08 Jun, 2011, 07:21 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See JForex javadoc for submiting an order:
https://www.dukascopy.com/client/javadoc//com/dukascopy/api/IEngine.html#submitOrder(java.lang.String,%20com.dukascopy.api.Instrument,%20com.dukascopy.api.IEngine.OrderCommand,%20double,%20double,%20double,%20double,%20double,%20long,%20java.lang.String)
and for setting trailing step to an order:
https://www.dukascopy.com/client/javadoc//com/dukascopy/api/IOrder.html#setStopLossPrice(double,%20com.dukascopy.api.OfferSide,%20double)
Note that you can't set trailing step in IEngine.submitOrder - you have to call IOrder.setStopLossPrice on the submitted order.


 
 Post subject: Re: Activating trailing upon the creation of an order Post rating: 0   New post Posted: Wed 08 Jun, 2011, 17:04 

User rating: -
awesome! Thanks a lot!

Just one last thing. Searched the forum, and google as well, but i couldn't find a solution. When compiling i get the following error:

Quote:
The type ... must implement the inherited abstract method IStrategy.onTick(Instrument, ITick)


Thanks in advance!


 
 Post subject: Re: Activating trailing upon the creation of an order Post rating: 0   New post Posted: Thu 09 Jun, 2011, 07:25 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
It means that your strategy java class lacks onTick method. That is, you should add:
public void onTick(Instrument instrument, ITick tick) throws JFException {
   //TODO: implement here some onTick logic
}
You might consider using some java IDE (like Eclipse), since they provide an auto-fix for such errors.


 

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