Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1963

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
Hello, I'm a new coder who is learning by myself so this might be a noob question but please bear with me...
What I want to do ===> create a custom indicator that has some hotkeys (for example by pressing Key "A" or "CTRL+A") that will execute a script or some other function.
Question =====> If I use #include Virtualkeys.mqh + WinUser.mqh and use OnChartEvent Keydown + switch case to execute this ( i am using already #defined keys in Virtualkeys.mqh for the case);
1. Will this hotkey work across platforms (windows/MAC OS/Linux)? ( I think Winuser imports user32.dll, not sure if MAC OS supports that)
2. Will this hotkey work across Keyboard layouts/regional settings (US QWERTY/US DVORAK)?
3.If it does not, Is there a way to make it happen? (I've been searching for a way to get a key as a input and set that into the code but haven't still found a way to do that)
4.Also if there is a way to get a key as a user input and use that key for the switch, please enlighten me guys.
Thanks in advance, and my apologies if this is a frequently asked noob question....Hello, I'm a new coder who is learning by myself so this might be a noob question but please bear with me...
What I want to do ===> create a custom indicator that has some hotkeys (for example by pressing Key "A" or "CTRL+A") that will execute a script or some other function.
Question =====> If I use #include Virtualkeys.mqh + WinUser.mqh and use OnChartEvent Keydown + switch case to execute this ( i am using already #defined keys in Virtualkeys.mqh for the case);
1. Will this hotkey work across platforms (windows/MAC OS/Linux)? ( I think Winuser imports user32.dll, not sure if MAC OS supports that)
2. Will this hotkey work across Keyboard layouts/regional settings (US QWERTY/US DVORAK)?
3.If it does not, Is there a way to make it happen? (I've been searching for a way to get a key as a input and set that into the code but haven't still found a way to do that)
4.Also if there is a way to get a key as a user input and use that key for the switch, please enlighten me guys.
Thanks in advance, and my apologies if this is a frequently asked noob question....There is no need to use "user.dll". The OnChartEvent() function can handle keyboard events.
There is no need to use "user.dll". The OnChartEvent() function can handle keyboard events.
Thanks for the reply. Really helped me clear that out.
It certainly seems easier to just let the user customize it, so will just do that :)
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close at a specific Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25
The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
Most brokers with variable spreads widen considerablf=bugy at end of day (5 PM ET) ± 30 minutes.
My GBPJPY shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 PIP spreads) in EURCHF? - General - MQL5 programming forum (2022)
Your condition is true for one minute. You will open one order per tick that minute.
What if there are no ticks during a specific candle period? There can be minutes between ticks during the Asian session, think M1 chart. Larger charts, think weekend, market holiday (country and broker specific), requires knowledge of when your broker stops and starts (not necessary the same as the market.)
"Free-of-Holes" Charts - MQL4 Articles
return serverHour == TradeHour && serverMinute == TradeMinute;
.am expiriensing some errors and i would like to know whre am wrong
Hi All. I am trying to get a very simple EA to place a set of pending long entries either side of current chart symbol price.
Can anyone look at the MT4 attached code and tell me why the orders aren't being placed
TIA
Please have a look at both the Experts and Journal log and report the error messages that are reported.
Remember that we cannot see your computer nor read your mind, so you need to provide as much relevant information as possible.
No one can help you if you don't explain in detail what is happening on your end.
Please have a look at both the Experts and Journal log and report the error messages that are reported.
Remember that we cannot see your computer nor read your mind, so you need to provide as much relevant information as possible.
No one can help you if you don't explain in detail what is happening on your end.
apologies. here is a screenshot from the journal of the tester
You have only shown one of the logs instead of both.
Add more debug prints to your code to print out the parameter values, because error code 3 is ...