error 130 again. I can not get rid of it.

 

Hi

Can some one help me.

I have a demo acount with FXCM UK and I can not put any stop loss or take profit in my orders.

I tried almost every thing from previous posts but no hope so far.

here is my Code:

all of these tries failed with error 130

ticket1=OrderSend(Symbol(),OP_BUY,0.1,price,3,Bid-150*Point,Bid+150*Point,"",0,0, Red);

or

ticket1=OrderSend(Symbol(),OP_BUY,0.1,price,3,Bid-15*Point,Bid+15*Point,"",0,0, Red);

or

ticket1=OrderSend(Symbol(),OP_BUY,0.1,price,3,NormalizeDouble(MarketInfo(Symbol(),MODE_BID)-(150*Point),Digits),NormalizeDouble(MarketInfo(Symbol(),MODE_BID)-(150*Point),Digits),"",0,0, Red);

or

ticket1=OrderSend(Symbol(),OP_BUY,0.1,price,3,NormalizeDouble(MarketInfo(Symbol(),MODE_BID)-(15*Point),Digits),NormalizeDouble(MarketInfo(Symbol(),MODE_BID)+(150*Point),Digits),"",0,0, Red);

I also tried different combination of normalizations and moved up and down the take profit and stop loss.

these are the market information values that I printed:

2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: Symbol -->GBPUSD
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: Time = 2009.11.17 18:03:50
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: Point = 0.00001
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: Ask = 1.67623
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: erroris:130
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: sl=1.67442 tp=1.67742 ask_price=1.67623 just an example of one case
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: Bid = 1.67592
2009.11.17 12:05:18 avalin_to_uk GBPUSD,M1: ticket1 ====> -1
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_FREEZELEVEL -->0.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MARGINREQUIRED -->838.04000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MARGINHEDGED -->50000.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MARGINMAINTENANCE -->100000.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MARGININIT -->100000.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MARGINCALCMODE -->0.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_PROFITCALCMODE -->0.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_SWAPTYPE -->1.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_TRADEALLOWED -->1.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_SWAPSHORT -->-5.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_SWAPLONG -->-5.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MAXLOT -->10000.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_LOTSTEP -->0.10000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_MINLOT -->0.10000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_TICKSIZE -->0.00001
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_TICKVALUE -->1.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_LOTSIZE -->100000.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_STOPLEVEL -->0.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_SPREAD-->14.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_DIGITS -->5.00000
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: MODE_POINT -->0.00001
2009.11.17 12:05:16 avalin_to_uk GBPUSD,M1: Symbol -->GBPUSD

Thanks for your help.

Khodam

 
I had similar problem last week on one demo account. I could not set. But after a while it worked, did you try to change demo server?
 

Try sending the order to open the trade first.

Then send OrderModfy() to set the SL and TP.

 
today i opened 2 demo accounts by 2 different brokers. I hit f9 on chart and choose "Market Order". On market order i cannot choose SL/TP anymore. I may be wrong but as i remember it was possible before. phy has right, i workaround my demo accounts to create order first then set tp/sl.
 
ticket1=OrderSend(Symbol(),OP_BUY,0.1,price,3,Bid-15*Point,Bid+15*Point,"",0,0, Red);

On a 5 digit broker, slippage is 0.3 pips and your stops are 1.5 pips, but the spread is 3.1 pips (based on Ask-Bid) BUT your printout said MODE_SPREAD-->14.00000

You probably want slippage to be at lease 3.0pips. The SL must be below

double	minGap.stops	= MarketInfo( Symbol(), MODE_STOPLEVEL )*Point;
double  SL.max=price - (Ask-Bid) - minGap;

You don't print price so is it equal to Ask?

Reason: