Trying to get Trades closed only at the beginning of each bar and from the indicator and not the OHLC.
I'm trying to get the EA to only close out specified trades at the very beginning of each new bar, but it closes out the trades anytime it hits the TP or SL levels. I want it to ONLY act on the indicator level and NOT by the OHLC and ONLY at the beginning of each new bar.
I have been using the following code to try and get it to only act at the start of each new bar, but it is not working in this EA for some reason:
ONLY act on the indicator level and NOT by the OHLC --> you can trigger your action by almost any condition you specify... use iCustom() to call indicator's value, if it's not embedded in your EA.
ONLY at the beginning of each new bar --> this has been answered many times, please search. keep in mind charts can have missing bars and EA or Indy can miss first tick of the bar.. HTH
https://www.mql5.com/en/forum/125561
Seems familiar...
ONLY at the beginning of each new bar --> this has been answered many times [...]
For example, https://www.mql5.com/en/forum/109887 and https://www.mql5.com/en/forum/125732. In short, don't use Volume[0] to check for the start of a new bar. It only works reliably in backtesting.
Hi,
I'll check them thanks. Along with the search engine here not finding things that we know are in the DataBase; There is also the typical problem of getting swamped with results and no way to refine them to find what is needed. Its pretty bad when a web search is much more proficient than the sites own search engine! )< 8(
ONLY act on the indicator level and NOT by the OHLC --> you can trigger your action by almost any condition you specify... use iCustom() to call indicator's value, if it's not embedded in your EA.
I do have the indicator in the EA in several places. I'm not familiar with iCustom yet., but it appears that I'm about to. As I said, the EA keeps getting triggered by OHLC and not just by the indicator line as I want it to.
Thanks to all for your assistance ! (< 8)
I was apprehensive of utilizing the volume as an indicator of a new bar. Once more the ol 'Spidey Sense' is right. In my experience it's ALWAYS right! But lots of times I don't listen to it as it is not what I WANT to do as opposed Should do or NEED to do (which == 'Dharma') and override it usually to the detriment that I end up regretting.
Thanks to everyone for the info and examples of better, more reliable methods.
Yes it is, It's from my query on this same issue.
I still haven't been able to get it to work properly utilizing either the Bar[] nor the Time[] arrays
ONLY act on the indicator level and NOT by the OHLC --> you can trigger your action by almost any condition you specify... use iCustom() to call indicator's value, if it's not embedded in your EA.
ONLY at the beginning of each new bar --> this has been answered many times, please search. keep in mind charts can have missing bars and EA or Indy can miss first tick of the bar.. HTH
Apparently so, but alas I haven't been able to get any of the techniques, approaches or methods to work reliably.
I can readily understand and appreciate missing ticks regularly, but entire bars when I am on a 1 hour chart ??
I hope I've understood you correctly and hope that helps
V
Hi Viffer,
I haven't been able to get any other approaches to work reliably and I can see the wisdom of your approach, especially as I am using longer intervals. I'll try utilizing the closing of bar 1 instead of the opening of bar 0.
Thanks for the suggestion
- 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'm trying to get the EA to only close out specified trades at the very beginning of each new bar, but it closes out the trades anytime it hits the TP or SL levels. I want it to ONLY act on the indicator level and NOT by the OHLC and ONLY at the beginning of each new bar.
I have been using the following code to try and get it to only act at the start of each new bar, but it is not working in this EA for some reason:
Thanks for any and all assistance (< 8)