bool IsNewCandle() { static datetime lastbar; datetime curbar = Time[0]; if(lastbar!=curbar) { lastbar=curbar; return (true); } else { return(false); } }
Serge:
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor
William Roeder:
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor
Thanks William, I will review those practices. I am new here and learning.
Regards, Serge
Mehmet Bastem:
Thank you Mehmet. I will give it a try and let you know. Serge
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone,
I would appreciate any help you can offer with an EA I am writing. The EA I wrote gives me a signal while a candle is open while I only want the signal to be provided after the candle closes and can't seem to figure out how to code for this.
Intent: Using CCI levels. Give sell signal when CCI value crosses from above +100 to below +100, buy signal when CCI value crosses from below -100 to above -100.
I thought the using shift position 1 and 2 for candles 1 and 2 would resolved this but it did not.
I then added the IsNewCandle script but did not change anything.
Here is the code I have so far.
Thank you for your assistance.
Serge