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.

Bollinger Band for Stop Loss
 Post subject: Bollinger Band for Stop Loss Post rating: 0   Post Posted: Fri 05 Oct, 2012, 08:07 

User rating: 0
Joined: Thu 26 Apr, 2012, 14:41
Posts: 7
I'd like to use the lower bollinger band (1 standard deviations) as a stop loss for a long position. I tried using the below snippets of code. However, It does not work even though I set bbands to double data type. What am I doing wrong / can I correct to remedy the situation?

lBBand1 = indicators.bbands(instrument, selectedPeriod, OfferSide.BID, AppliedPrice.HIGH, 12, 1,1, MaType.SMA,0)[2];
double  LstopLossPrice = lBBand1;
order = engine.submitOrder(getLabel(instrument), instrument, OrderCommand.BUY, 0.01,0,5,LstopLossPrice,SstopLossPrice);


The ERROR I get on the console is
Quote:
05:58:56 Order REJECTED: SELL EUR/USD, REASON: STOP LOSS Invalid price format - please use increments of 0.1 pip.; TAKE PROFIT Invalid price format - please use increments of 0.1 pip.


Cheers,

RG


 
 Post subject: Re: Bollinger Band for Stop Loss Post rating: 0   Post Posted: Fri 05 Oct, 2012, 08:17 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Rounding_prices


 
 Post subject: Re: Bollinger Band for Stop Loss Post rating: 0   Post Posted: Mon 08 Oct, 2012, 06:49 

User rating: 0
Joined: Thu 26 Apr, 2012, 14:41
Posts: 7
Thanks! That did it.


 

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