Problem with OrderSend for my first EA in mql4
Eleni Anna Branou:
Please use the </< button to insert your code above.
thanks Eleni, that answered half of the questions.
Do you know why the code doesn't work?
oekosimon:
thanks Eleni, that answered half of the questions.
Do you know why the code doesn't work?
Rudeness won't help you.
Eleni Anna Branou:
Sorry, it wasn't meant to be rude, I was actually greatful for your answer
Rudeness won't help you.
Minimum. Need to check STOPS_LEVEL
int stopLevel = (int)SymbolInfoInteger( _Symbol, SYMBOL_TRADE_STOPS_LEVEL )+1; int ticket = OrderSend( _Symbol, OP_SELL, lots, Bid, 3, Bid+(stopLevel>stoploss ? stopLevel : stoploss)*Point, Bid-(stopLevel>takeprofit ? stopLevel : takeprofit)*Point, "Sell trade by expert", magic, NULL, clrBlue );It can be more. Specified by you.
Konstantin Nikitin:
ok, I just learned that it works ok in Forex, but just not in stock indexes such as Ger30
Minimum. Need to check STOPS_LEVEL
It can be more. Specified by you.OrderSend (Symbol(), OP_SELL, lots, Bid, 3, Bid+stoploss*Point, Bid-takeprofit*Point
-
You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
-
Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at
a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools -> Options {control-O} -> charts -> Show ask line.)
- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is usually wrong.
- Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 and MetaTrader 4 - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 and MetaTrader 4 - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 and MetaTrader 4 - MQL4 programming forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
whroeder1:
thanks, you were rigth, the issue was with the lot size
-
You buy at the Ask and sell at the Bid.
- Your buy order's TP/SL are triggered when the Bid reaches it. Not the Ask.
-
Your sell order's TP/SL will be triggered when the Ask reaches it. To trigger at
a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 3 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools -> Options {control-O} -> charts -> Show ask line.)

Hi guys,
I'm trying to make the OrderSend function work for my first EA, but for some reason it's not executed,
can anyone tell me what I need to change?
Update:
I can see that it works on forex, but I need it to work in stock indexes through spreadbetting.
For some reason it works in GBPUSD, but not GER30 - how do I change that?