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.

Setting take profit and stop loss, help please.
 Post subject: Setting take profit and stop loss, help please. Post rating: 0   New post Posted: Mon 04 Jun, 2018, 11:03 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
Hello,

    order = engine.submitOrder("x" , Instrument.EURUSD, OrderCommand.BUY, 0.1, 0, 10, 10, 30,0,"EBIN");


the code posted above does not result in orders of 30 take-profit and 10 stop-loss.
Can someone show me a working corresponding code, please?

Thank you!


 
 Post subject: Re: Setting take profit and stop loss, help please. Post rating: 1   New post Posted: Tue 05 Jun, 2018, 09:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello,

1)Order label must be unique.
2)StopLoss and TakeProfit must be specified correctly.

ITick lastTick = history.getLastTick(Instrument.EURUSD);
order = engine.submitOrder("order" + System.currentTimeMillis(), Instrument.EURUSD, IEngine.OrderCommand.BUY, 0.1, 0, 10, lastTick.getAsk() - 10 * Instrument.EURUSD.getPipValue(),
                lastTick.getAsk() + 30 * Instrument.EURUSD.getPipValue(), 0, "EBIN");


 
 Post subject: Re: Setting take profit and stop loss, help please. Post rating: 0   New post Posted: Tue 05 Jun, 2018, 11:48 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
Hello,

Thank you so much! You are a true hero! My understanding of the stop-loss and take-profit system was as showed above, I should have read the instructions more clearly. I am so glad that you helped me! I hope everything well for you in life!


 

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