Invalid Stops Error on live account

 

Hi,

I have created an expert that I have been testing on a demo account. It works fine on the demo, but when I try and do the same thing on a live account I get an error "Invalid Stops" when I try and place the order.

Here is the exact data I am sending:

OrderSend("GBPUSD",0,0.10000000,1.47850000,100,1.43850000,1.48350000,"Test",25788,0,16748574);

There is a stop of 400 pips, and a profit of 50 pips. I have tried taking the stop down to 300 and 200 pips, but it still does the same.

My account balance is $2600, so I thought that it might not like my stop, but based on .1 lots, that is only a $400 maximum loss. The account can handle that.

I can place the trades manually, but it won't allow the trades to be put in through the expert.

Any ideas?

Regards

Robert

 

Robert

0. I have never seen post whereby TradeOperation function call 'code' shows ALL hard wired constants as actuals.

Not believe this what actually happening. If it is, this is one of most likely many errors...

Suggest you publish real code else no sound advice available imho.

.

1. for a start you can only send Buy/Sell market order IF price is [most recent] Ask/Bid value, respectively.

cannot put in any price if market order. Have you considered reading the Mql book? link top of page.

2. 100points slippage is EXTREME, would expect <10 and even 10 is massive, certainly not 100

3. .....

Observation: you are willing to suffer 400 pips expenses for 50 pips possible income????

.

"The account can handle that."

Well then, you should consider spending 400 bucks on EA s/w engineer

.

Good luck ...

.

btw, not attempting to be rude but programmed FX trading is not a game....

 
fbj:

I have never seen post whereby TradeOperation function call 'code' shows ALL hard wired constants as actuals.

Not believe this what actually happening. If it is, this is one of most likely many errors...

You're probably right that the explanation lies in what the code is really doing, versus what it's represented here as doing.


But if the code really does work consistently on a demo account, but not a live account, then things become more strange. For example, there are some brokers who don't allow stops on a market order - you have to do an OrderSend() and then an OrderModify() - but it's hard to believe that they'd do this on live accounts without also doing it on demo accounts.


Observation: you are willing to suffer 400 pips expenses for 50 pips possible income????

A ratio like this may or may not be wise, but it's not that uncommon. For example, the trades currently listed on Fapturbo's site - which, incidentally, is showing an overall loss - have an average losing trade three times the size of the average winning trade, and the worst loss is 8 times the size of the best win. Not quite the same principle, but broadly comparable.


 

What I sent was the actual values that land up on the OrderSend command.

Here is the actual code:

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,slip,Ask-(Stoploss*Point),Ask+(TakeProfit*Point),"Test",MagicNumber,0,clOpenBuy);

Lots = 0.1

Slip = 100 - I set this high thinking it might be the cause of the trouble. I will set it back to 10.

StopLoss = 400

TakeProfit = 50

400 does seem to be quite a risk, but on back testing, the high value actually allows the market to swing around. I have also been playing around with the 50 pips profit. This seems to be a good value to take for now. Any more actually makes less profit.

I am busy testing to see if I can go in with zero StopLoss and zero TakeProfit, and then use OrderModify to put in the StopLoss and Profit. I am still waiting for my Expert to go in to see if it works.

 

RH

> 0,0.10000000,1.47850000,100,1.43850000,1.48350000

I would always NormalizeDouble those values

as RealSL = NormalizeDouble(Ask-(Stoploss*Point), Digits); etc

then OrderSend with the RealSL, etc

Also if there is much code prior to the call to Ask or Bid, always do a RefreshRates() or get MarketInfo just before posting the value

FWIW

-BB-

 

Hi Robert

Try fixed values for the last 3 parameters and check the type of of the variables Stoploss and Takeprofit they should be double. It might be a misleading error.

Reason: