you have to buy at Bid not Ask
No you don't, you buy at Ask.
No you don't, you buy at Ask.
oh yeah... my bad
maybe the stoploss is too close to the open price
you should add a verification with STOP_LEVELS
![Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants](https://c.mql5.com/36/40/documentation-on-mql5-constants__24.png)
- www.mql5.com
It just doesn't buy when the right conditions is present.
Check your parameters for iStochastic
double KLine = iStochastic(NULL,0,5,3,3,MODE_SMA,MODE_MAIN,0,0);
I think that you have price field and mode reversed.
Guys help me. I am seriosu, this makes no sense.
It just doesn't buy when the right conditions is present.
oid OnTick () { double parabolic = iSAR ( _Symbol , _Period , 0.02 , 0.2 , 0 ); double KLine = iStochastic ( _Symbol , 0 , 5 , 3 , 3 , MODE_SMA ,STO_LOWHIGH, 0 , 0 ); if ( OrdersTotal () <= 0 ) { if (KLine < 20 && Ask > parabolic) { OrderSend ( _Symbol ,OP_BUY, 0.1 ,Ask, 3 ,Ask- 50 * _Point ,Ask+ 25 * _Point , NULL , 0 , 0 ,Green); } } }
try this
if doesnt work check conditions
OrdersTotal () shows you if there are any open orders in your account. It doesn't matter whether the symbol is a buy order or a sell order.
![Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Orders in DOM](https://c.mql5.com/36/40/documentation-on-mql5-constants__25.png)
- www.mql5.com
OrderSend(_Symbol,OP_BUY,0.1,Ask,3,Ask-50*_Point,Ask+25*_Point,NULL,0,0,Green);
-
Always use strict. Fixing the warnings will save you hours of debugging, but you must understand the differences.
-
You would know why had you bothered to check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014 -
You buy at the Ask and sell at the Bid.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 -
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.)
Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar).
-
-
You are trying to make your SL 50 points minus the spread (say 30 points) or 20 points. You can't put them closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
Requirements and Limitations in Making Trades - Appendixes - MQL4 TutorialOn some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Guys help me. I am seriosu, this makes no sense.
It just doesn't buy when the right conditions is present.