Stop order above current price - OrderSend error 4107

 

Hello,

Firstly apologies for my simplistic coding error. A search of some other posts found some help regarding the error but not for my specific question and i have tried a few alternatives. What i want to do is place a buy stop, a specific number of pips away from the ask. Below is where i am at, but i an getting the "OrderSend error 4107".


extern double PriceBuffer = 25;
RefreshRates();     
ticket=OrderSend(Symbol(),OP_BUYSTOP,lots,NormalizeDouble(Ask + PriceBuffer,Digits),slippage,NormalizeDouble(Ask - trailingStop,Digits),
                  NormalizeDouble(Ask + TakeProfit,Digits),"buy",magicNumber,0,Green);     
if(ticket<0)


Thanks in advance,

Maxdoer

 
maxdoer: Firstly apologies for my simplistic coding error. A search of some other posts found some help regarding the error but not for my specific question and i have tried a few alternatives. What i want to do is place a buy stop, a specific number of pips away from the ask. Below is where i am at, but i an getting the "OrderSend error 4107".

What do you think you get when you do this?

NormalizeDouble(Ask + PriceBuffer,Digits)
Normalize (1.54321 + 25 ), Limited to 4/5 Decimals.
 
maxdoer:

Hello,

Firstly apologies for my simplistic coding error. A search of some other posts found some help regarding the error but not for my specific question and i have tried a few alternatives. What i want to do is place a buy stop, a specific number of pips away from the ask. Below is where i am at, but i an getting the "OrderSend error 4107".

So if you were Buying GBPUSD you would buy at 1.636 + 25 = 26.636 ? what is the value of your trailingStop variable ?
 

Thankyou both very much, i see what i was doing now. That was stupid, i have to probably set my price buffer to get it to ASK + 0.0025

@raptorUK - The trailing stop is variable that by default is set to 200 pips. I will have to also get the entry fixed so it removes 0.0200 instead of 200.

 
maxdoer:

Thankyou both very much, i see what i was doing now. That was stupid, i have to probably set my price buffer to get it to ASK + 0.0025

@raptorUK - The trailing stop is variable that by default is set to 200 pips. I will have to also get the entry fixed so it removes 0.0200 instead of 200.

Multiply by Point