Good suggestion but you should still use the OrderHistory() to avoid situations where you have to restart your EA (power failure etc). Also consider global variables, writing to file etc.
:: perhaps you have administrator right issues on your vista? or something alike. For sharing data (limited), it can work with files, you can use clipboard or a difficult one is find a proper way to allocate a memory space to share between apps (forget that, it's not that easy)... if it's about much data you can use a heap MySQL database structure (only memory located database, very fast)... well some of the doable possibilities to keep you busy
ps. the file functions in metatrader are not allowed to write & read in other locations, use API file functions.
IN10TION
myaron: I'm trying to write data to a file from one metatrader in order to read it from a second metatrader.
The problem is that when I'm trying to write to c:\ I'm getting error message "absolute file path "C:\EURUSD.txt" is not allowed"
Any Idea or other way to share data between two metatrader applications ?
could anyone help me with my question please? I would like to know if it is possible to trade when the last bar is just finished? i.e. opening positions with close price of the last bar?
I thought about waiting for a tick which belongs to newer bar then the last bar. For example when I use M1 chart and the last tick I recieved belongs to the bar from 11:34:00 to 11:35:00 (so the iTime() value for this tick is 11:34:00), in this situation I check the iTime() value of every tick I recieve after that and when it is the first tick with the time greater then 11:34:00 (i.e. 11:35:00) I know that the last bar was finised and the new one has been just opened. But the problem is, that it is too late to trade with close price of the bar which has been just finished because the open price (of the new bar) can be different from the close price (of the previous bar).
Are there any tools or method how to trade exactly in the end of bar?
I hope, somebody helps me because I don't have another idea.
You can only trade as the first tick of the next bar because you never know if there will be one more tick before the end of bar or not.
Sometimes the last tick can be 30 sec before the end of the bar and sometimes 1s, impossible to know in advance.
Anyway honestly in most cases it is just 1 pip difference between the close of the bar and the start of the new one, so in my opinion it is not a big deal.
:: if you can refresh your charts automatically so that time will follow exactly to the end time of the bar, you will have your last price value of that bar, if there is another tick coming in 30 seconds after the last bar end time, what is considered the beginning of a new bar, in that way you don't have to wait for ticks to refresh or trigger your price against time.
:: so it is possible, but is it useful for you? I don't know why you're seeking such a thing...
:: I've made an auto updating gadget like this for myself, that I didn't published yet ( IN10TION ChartAttack ), so it doesn't need ticks to update your charts... I'm still testing it, but it works perfect, it does let your CPU work a little harder. ( + 10|20 % )
IN10TION
mellda: Hello,
could anyone help me with my question please? I would like to know if it is possible to trade when the last bar is just finished? i.e. opening positions with close price of the last bar?
I thought about waiting for a tick which belongs to newer bar then the last bar. For example when I use M1 chart and the last tick I recieved belongs to the bar from 11:34:00 to 11:35:00 (so the iTime() value for this tick is 11:34:00), in this situation I check the iTime() value of every tick I recieve after that and when it is the first tick with the time greater then 11:34:00 (i.e. 11:35:00) I know that the last bar was finised and the new one has been just opened. But the problem is, that it is too late to trade with close price of the bar which has been just finished because the open price (of the new bar) can be different from the close price (of the previous bar).
Are there any tools or method how to trade exactly in the end of bar?
I hope, somebody helps me because I don't have another idea.
Good suggestion but you should still use the OrderHistory() to avoid situations where you have to restart your EA (power failure etc). Also consider global variables, writing to file etc.
Lux
I'm trying to write data to a file from one metatrader in order to read it from a second metatrader.
The problem is that when I'm trying to write to c:\ I'm getting error message "absolute file path "C:\EURUSD.txt" is not allowed"
Any Idea or other way to share data between two metatrader applications ?Please make it work...
Hi. I refer to this post. https://www.mql5.com/en/forum/general
Has anyone tried to get this EA to work? It works when backtesting but when I tried to forward test this EA on demo, there are no trades. Please help
LF
Hi. I refer to this post. https://www.mql5.com/en/forum/general
Has anyone tried to get this EA to work? It works when backtesting but when I tried to forward test this EA on demo, there are no trades. Please help
LFTrading exactly in the end of bar
Hello,
could anyone help me with my question please? I would like to know if it is possible to trade when the last bar is just finished? i.e. opening positions with close price of the last bar?
I thought about waiting for a tick which belongs to newer bar then the last bar. For example when I use M1 chart and the last tick I recieved belongs to the bar from 11:34:00 to 11:35:00 (so the iTime() value for this tick is 11:34:00), in this situation I check the iTime() value of every tick I recieve after that and when it is the first tick with the time greater then 11:34:00 (i.e. 11:35:00) I know that the last bar was finised and the new one has been just opened. But the problem is, that it is too late to trade with close price of the bar which has been just finished because the open price (of the new bar) can be different from the close price (of the previous bar).
Are there any tools or method how to trade exactly in the end of bar?
I hope, somebody helps me because I don't have another idea.
PS. I am sorry for my english
You can only trade as the first tick of the next bar because you never know if there will be one more tick before the end of bar or not.
Sometimes the last tick can be 30 sec before the end of the bar and sometimes 1s, impossible to know in advance.
Anyway honestly in most cases it is just 1 pip difference between the close of the bar and the start of the new one, so in my opinion it is not a big deal.
Hello,
could anyone help me with my question please? I would like to know if it is possible to trade when the last bar is just finished? i.e. opening positions with close price of the last bar?
I thought about waiting for a tick which belongs to newer bar then the last bar. For example when I use M1 chart and the last tick I recieved belongs to the bar from 11:34:00 to 11:35:00 (so the iTime() value for this tick is 11:34:00), in this situation I check the iTime() value of every tick I recieve after that and when it is the first tick with the time greater then 11:34:00 (i.e. 11:35:00) I know that the last bar was finised and the new one has been just opened. But the problem is, that it is too late to trade with close price of the bar which has been just finished because the open price (of the new bar) can be different from the close price (of the previous bar).
Are there any tools or method how to trade exactly in the end of bar?
I hope, somebody helps me because I don't have another idea.
PS. I am sorry for my englishHi IN10TION, What did you modify if you don't mind me asking...?
Thanks again:)
Hi IN10TION, What did you modify if you don't mind me asking...? Thanks again:)
Ha.. Can you use the same key on your keyboard to make this work as well?
Cheers!