Please HELP! How to make PlaySound for alert only make a sound 3 times per candle not on every tick?
First, fix the error of receiving the indicator handle: in MQL5, the indicator handle MUST be received ONCE (this is done in OnTick).
- 2020.09.17
- www.mql5.com
-
Perhaps you should read the manual, especially the examples.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010 -
&& (myMovingAverageArray1[0] - myMovingAverageArray2[0] <0.00010)
Don't hard code constants - your code breaks on JPY pairs. If you want one PIP code it that way (1*PIP).PIP, Point, or Tick are all different in general.
What is a TICK? - MQL4 programming forum 2014.08.03Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum 2017.02.09
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum 2018.01.15 -
(myMovingAverageArray2[0] > myMovingAverageArray1[0]) && (myMovingAverageArray2[0] - myMovingAverageArray1[0] <0.00010) && (myMovingAverageArray2[0] - myMovingAverageArray1[0] >0.00000)
The first and third conditions are identical. One or the other - not both.
- Don_xyZ: I am trying to make a proximity indicator based on 2 EMAs but I don't know how to make the sound alert only ring 3 times per candle. Can someone please help me with this? This is what I've done so far.
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
No free help 2017.04.21Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum 2018.05.12if(condition){ static datetime mute=0; datetime now = TimeCurrent(); if(mute < now){ mute = now + PeriodSeconds() / 3; // 3 times per candle max. Alert(…); } }
Is that so hard that you couldn't even attempt it?
-
Perhaps you should read the manual, especially the examples.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010 - Don't hard code constants - your code breaks on JPY pairs. If you want one PIP code it that way (1*PIP).
PIP, Point, or Tick are all different in general.
What is a TICK? - MQL4 programming forum 2014.08.03Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
How to manage JPY pairs with parameters? - MQL4 programming forum 2017.02.09
Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum 2018.01.15 -
The first and third conditions are identical. One or the other - not both.
-
Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
No free help 2017.04.21Or pay someone. Top of every page is the link Freelance.
Is that so hard that you couldn't even attempt it?
Hiring to write script - General - MQL5 programming forum 2018.05.12
So sorry if I appeared that way.
Fact is I am lacking in coding skills and admit that openly, I am still trying to learn and that code is the extent of my knowledge in mql5.
I really have no previous coding experience before, no IT background whatsoever so yes it's difficult for me.
I have since bought a course but none is available for mql5 (there are but judging by the reviews from the site I deemed it not worth my time) so I bought the one for mql4 instead and I am already able to make a very simple EA for EMA crossover on mql4 now which is of course absolutely meaningless compared to your library of knowledge.
That said, I am thankful that you showed some pointers to this newbie. Enjoy your day!
ps: yes, the code is designed specifically for GBP/USD and EUR/USD, I don't have any intention on using it on other pairs.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I am trying to make a proximity indicator based on 2 EMAs but I don't know how to make the sound alert only ring 3 times per candle. Can someone please help me with this? This is what I've done so far.
Thank you in advance!