Download MetaTrader 5

Stop order above current price - OrderSend error 4107

To add comments, please log in or register
max
13
max  

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

Ubzen
5394
Ubzen  
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.
Simon Gniadkowski
Moderator
18004
Simon Gniadkowski  
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 ?
max
13
max  

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.

Simon Gniadkowski
Moderator
18004
Simon Gniadkowski  
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
To add comments, please log in or register