real mode OK, can work, can get two buffers.
but test mode not work, can not get 2nd buffer, my God! Why?
- www.mql5.com
real work mode with demo account :
find error in log :
2010.08.23 20:52:21 Trades '669279' : deal #1295772 sell 1.00 EURUSD at 1.27003 done (based on order #1218788)
2010.08.23 20:52:21 Trades '669279' : order #1218788 sell 1.00 EURUSD at 1.27003 done
2010.08.23 20:52:19 Trades '669279' : accepted instant sell 1.00 EURUSD at 1.27003 tp: 1.26613
2010.08.23 20:52:18 Trades '669279' : instant sell 1.00 EURUSD at 1.27003 tp: 1.26613
2010.08.23 20:52:17 Trades '669279' : failed instant sell 6.00 EURUSD at 1.27011 sl: 1.26997 tp: 1.27434 [Invalid stops]
2010.08.23 20:52:16 Trades '669279' : deal #1295771 sell 1.00 EURUSD at 1.27011 done (based on order #1218787)
2010.08.23 20:52:16 Trades '669279' : order #1218787 sell 1.00 EURUSD at 1.27011 done
2010.08.23 20:52:15 Trades '669279' : accepted instant sell 1.00 EURUSD at 1.27011 tp: 1.26621
2010.08.23 20:52:13 Trades '669279' : instant sell 1.00 EURUSD at 1.27011 tp: 1.26621
2010.08.23 20:52:13 Trades '669279' : failed instant sell 7.00 EURUSD at 1.27003 sl: 1.26989 tp: 1.27434 [Invalid stops]
What are those in blue ?
(based on order #1218788) ---- before there is a 7 lots buy 1218788.
I only send sell 1 lot at bid price and set only TP, no SL, What are there sell 7.00 EURUSD and sell 6.00 EURUSD ????
- www.mql5.com
Hi DxdCn,
I think it will be a bit difficult for anyone to understand all these without seeing how your code looks like. There may be something wrong somewhere in your code or it may not really be a problem with the codes, however, making available some major parts of your code may assist someone to understand where the problem is.
code: I only check some trade code, have not writen full EA.
1st, only to buy :
void OnTick() { MqlTradeRequest m_request; // request data MqlTradeResult m_result; // result data m_request.action=TRADE_ACTION_DEAL; m_request.volume=1; m_request.sl=0.0; m_request.tp=0.0; m_request.deviation=dev; m_request.magic=Magic_No; m_request.symbol=symbol; m_request.type_filling=ORDER_FILLING_AON; m_request.type=ORDER_TYPE_BUY; m_request.price=AskPrice; m_request.tp=AskPrice+TP*Point; bool x= OrderSend(m_request,m_result); Sleep(1000); }
then stop ( now have 7 lots position buy),
then run another code only to sell: so get the above log.
void OnTick() { MqlTradeRequest m_request; // request data MqlTradeResult m_result; // result data m_request.action=TRADE_ACTION_DEAL; m_request.volume=1; m_request.sl=0.0; m_request.tp=0.0; m_request.deviation=dev; m_request.magic=Magic_No; m_request.symbol=symbol; m_request.type_filling=ORDER_FILLING_AON; m_request.type=ORDER_TYPE_SELL; m_request.price=BidPrice; m_request.tp=BidPrice-TP*Point;break; bool x= OrderSend(m_request,m_result); Sleep(1000); }
code: I only check some trade code, have not writen full EA.
1st, only to buy :
then stop ( now have 7 lots position buy),
then run another code only to sell: so get the above log.
Hi,
This codes you provided will not be the source of the problem you are talking about. First of all, how did you get your AskPrice, TP, BidPrice, symbol, etc. That should be somewhere in a code which you have not provided. For example, how did you determine when to BUY or when to SELL... Also, you provided " m_request.sl=0.0; m_request.tp=0.0; " and again in the same code, you have " m_request.tp=BidPrice-TP*Point;break; " What does this code mean???
Anyway, the simple truth is that if you use the above codes to either open a BUY or a SELL, it will keep opening as many BUYS FOR AS LONG AS YOU HAVE ENOUGH FREE MARGIN to open it. So if YOU DON'T HAVE A CONTROL IN YOUR CODE AS TO HOW MANY BUYS should be opened, it will continue opening more BUYS and adding them to the already opened Buy position. The same goes for the SELL too.
What you will see in your Results tab if you select Orders & Deals will look like below:
I have a bunch of errors ?/reports on custom indicators on this forum but it appears no one solved until now.
Here a similar problem I described some time ago: https://www.mql5.com/en/forum/1364
I think it is similar to your one. In a custom indicator it appears the problems start if we try use buffer index > 1.
- www.mql5.com
I have a bunch of errors ?/reports on custom indicators on this forum but it appears no one solved until now.
Here a similar problem I described some time ago: https://www.mql5.com/en/forum/1364
I think it is similar to your one. In a custom indicator it appears the problems start if we try use buffer index > 1.
Hello,
Have you tried reading this article?
https://www.mql5.com/en/articles/127
Maybe it will give you more understanding about the problem.
- 2010.07.26
- Dmitry Fedoseev
- www.mql5.com
Hi,
-------" m_request.sl=0.0; m_request.tp=0.0; " and again in the same code, you have " m_request.tp=BidPrice-TP*Point;break; " What does this code mean???
Anyway, the simple truth is that if you use the above codes to either open a BUY or a SELL, it will keep opening as many BUYS FOR AS LONG AS YOU HAVE ENOUGH FREE MARGIN to open it. So if YOU DON'T HAVE A CONTROL IN YOUR CODE AS TO HOW MANY BUYS should be opened, it will continue opening more BUYS and adding them to the already opened Buy position. The same goes for the SELL too.
What you will see in your Results tab if you select Orders & Deals will look like below:
Yes, 0.0 is init values, m_request.tp=BidPrice-TP*Point;break; " What does this code mean??? means I only set TP not set SL. and each order 1 lot.
Orders & Deals will look like below: yes, I got that.
please note what I do:
1st test buy: I press enable-EA toolbar button to start buy_EA (1st EA), then severent seconds, I click again enable-EA toolbar button to stop it, and remove it, now, some buy-orders accept, total 7 lots position.
2nd test sell: I load 2nd sell-EA, and press enable-EA toolbar button to start Sell_EA (2nd EA), .....
So so.....,
my questions is I only send buy or sell 1 lot with TP orders, Why are there bellow records in log?
2010.08.23 20:52:17 Trades '669279' : failed instant sell 6.00 EURUSD at 1.27011 sl: 1.26997 tp: 1.27434 [Invalid stops]
2010.08.23 20:52:13 Trades '669279' : failed instant sell 7.00 EURUSD at 1.27003 sl: 1.26989 tp: 1.27434 [Invalid stops]
I have a bunch of errors ?/reports on custom indicators on this forum but it appears no one solved until now.
Here a similar problem I described some time ago: https://www.mql5.com/en/forum/1364
I think it is similar to your one. In a custom indicator it appears the problems start if we try use buffer index > 1.
Copybuffer for 2nd buffer sometime can work ,sometime not work( get all 0 array) .
Yes, 0.0 is init values, m_request.tp=BidPrice-TP*Point;break; " What does this code mean??? means I only set TP not set SL. and each order 1 lot.
Orders & Deals will look like below: yes, I got that.
please note what I do:
1st test buy: I press enable-EA toolbar button to start buy_EA (1st EA), then severent seconds, I click again enable-EA toolbar button to stop it, and remove it, now, some buy-orders accept, total 7 lots position.
2nd test sell: I load 2nd sell-EA, and press enable-EA toolbar button to start Sell_EA (2nd EA), .....
So so.....,
my questions is I only send buy or sell 1 lot with TP orders, Why are there bellow records in log?
2010.08.23 20:52:17 Trades '669279' : failed instant sell 6.00 EURUSD at 1.27011 sl: 1.26997 tp: 1.27434 [Invalid stops]
2010.08.23 20:52:13 Trades '669279' : failed instant sell 7.00 EURUSD at 1.27003 sl: 1.26989 tp: 1.27434 [Invalid stops]
What you have there is something like this:
1. You have opened a position that has a certain tp and sl.
2. You try to close that position using a function that "knows" of those sl and tp but none has been reached.
That is wrong because it did not reach your stop loss or take profit. What you want to do is close a position, even though the price did not touch your sl or tp.
To do that, you need to call a different LongClose() or ShortClose(), that will have the SL and TP set to 0 - that means that no matter what position you have open, it will close it.
In the meantime, I have the same problem with iCustom. For a second custom indicator, the buffer will only get 0 values.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to get 2nd buffer of a Custom Indicator.
in indicator
when call CopyBuffer ... in EA,
for 1st buffer, all OK,
but for 2nd buffer, can get, but all values is 0 !
--------------------------------------------------------------------------------------------------------------------------------------if I exchange position index of 2nd buffer and 1st buffer,
in indicator
when call CopyBuffer ... in EA,
Still OK for
not for
What's wrong ???