Dukascopy
 
 
Wiki JStore Search Login

Stoploss in pips versus stoploss price
 Post subject: Stoploss in pips versus stoploss price Post rating: 0   New post Posted: Wed 08 May, 2013, 09:46 
User avatar

User rating: 0
Joined: Sat 16 Mar, 2013, 21:16
Posts: 10
Location: SpainSpain
Hi,

May be there is a bug related with stoploss.
For example, Sending a buy order with defaultStoploss in pips make a right code like this:

I) stoploss = lastTick.Bid - defaultStoploss*pipsSize;

but if you atach an integer variable like "myStoploss" to define order stoploss in pips then code is :

II) stoploss = round(instrument, myStoploss);

This last code is correct to define stoploss in absolute price but not in pips. Usually stoploss in pips means a diferential price from actual price but not an absolute price. So I expect something like following code:

III) stoploss = lastTick.Bid - myStoploss*pipsSize;

what do you think about this? :)

Thank you,

Ramon


 
 Post subject: Re: Stoploss in pips versus stoploss price Post rating: 0   New post Posted: Fri 10 May, 2013, 14:54 
Visual JForex expert at Dukascopy
User avatar

User rating: 4
Joined: Fri 06 Feb, 2009, 16:34
Posts: 130
parrondo wrote:
So I expect something like following code:

III) stoploss = lastTick.Bid - myStoploss*pipsSize;

It is already happens as you write. If it is not, could you provide the proofs (java source + vfs) ? :)


 
 Post subject: Re: Stoploss in pips versus stoploss price Post rating: 0   New post Posted: Sun 12 May, 2013, 09:30 
User avatar

User rating: 0
Joined: Sat 16 Mar, 2013, 21:16
Posts: 10
Location: SpainSpain
Here it is, :) thank you:

Java code snippet:

private void OpenatMarket_block_25(Integer flow) {
Instrument argument_1 = defaultInstrument;
double argument_2 = defaultTradeAmount;
int argument_3 = defaultSlippage;
int argument_4 = myStoploss; //This is in pips (int)
int argument_5 = defaultTakeProfit;
String argument_6 = "";
ITick tick = getLastTick(argument_1);

IEngine.OrderCommand command = IEngine.OrderCommand.BUY;

double stopLoss = round(argument_4, argument_1);// and this is wrong
double takeProfit = tick.getBid() + argument_1.getPipValue() * argument_5;

try {
String label = getLabel();
IOrder order = context.getEngine().submitOrder(label, argument_1, command, argument_2, 0, argument_3, stopLoss, takeProfit, 0, argument_6);
} catch (JFException e) {
e.printStackTrace();
}
}

and here is the file:


Attachments:
SMA1.vfs [27.78 KiB]
Downloaded 309 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.
 
 Post subject: Re: Stoploss in pips versus stoploss price Post rating: 0   New post Posted: Mon 13 May, 2013, 14:32 
Visual JForex expert at Dukascopy
User avatar

User rating: 4
Joined: Fri 06 Feb, 2009, 16:34
Posts: 130
[quote="parrondo"]Here it is, :) quote]
Thank you for good bug report, but as possible to see you have mistake inside Visual JForex strategy - it hasnt start value for myStoploss, that's why code generation happens wrong.


 

Jump to:  

cron
  © 1998-2024 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