KeyBoard Trader

  • Thread starter Thread starter Phylo
  • Start date Start date
  • Watchers Watchers 1

Phylo

Senior member
Messages
3,419
Likes
360
KeyBoard Trader

This MT4 EA is a FREE AS-IS project –
  1. Note: This EA was developed using a UK Compact/Mini Keyboard - so no functions on NumLock Keys. Thoroughly test and accommodate for differences in layout when using a keyboard other than a UK keyboard.
  2. I developed due to dissatisfied with key combination (Ctrl+Key, Alt+Key, etc.) in existing available free keyboard traders. All function of this EA are single key function, inclusive of those that are by default key combinations (Ctrl+T, Ctrl+A, etc).
  3. I developed this some years ago with MT4 running on Linux Mint.
  4. Note: For the benefit of newbies - there is no MQL4 code applicable specifically to Linux and this EA is not specifically coded for Linux - such, would be nonsense. This EA will run just fine on Windows 10 or 11 or, as some prefer, BG's shite.
  5. This will install MT4 Terminal on Linux and automatically install and update Wine – https://www.metatrader4.com/en/tradi.../install_linux
  6. Suggestion: If running more than one MT4 Terminal on Linux, open each terminal in a different workspace. The below image illustrates 5 work spaces
    workspace.png
  7. Recently tested on Linux Mint 2.2, Windows 10 & 11
  8. While all developed features tested on Linux work perfectly, the screenshot function (Button F) does not work on Windows 10 & 11 installation. The code is bog-standard code and the fault is not with the code. Should be some indicators around, if needed. Edit - forgot: The Font Bold function does not work in Linux due to OS difference in font specification.
  9. I use Linux exclusively, and cannot be bothered with BG’s shite.
Pending available time – I may develop in MQL5 for MT5.

All instances of the Expert Advisor are of the same core KeyBoard Trader EA code.
What are the differences ?
Only - the default lot sizes allocated to the number buttons 1,2,3,4,5,6,7,8,9,0. This merely as convenience, according to lot preference or use.

Button Functions:
Note: All button functions pertain to the relevant chart ‘symbol’.

Buttons 1,2,3,4,5,6,7,8,9,0 : default or custom allocated lots.

Default Lot & LotStep Allocations
  1. KBT_Micro: Buttons 1-0 // 0.01–0.10 lots. // LotStep = 0.01
  2. KBT_Mini: Buttons 1-0 // 0.10–1.00 lots. // LotStep = 0.05
  3. KBT_Lots_1-10: Buttons 1-0 // 1.00–10.00 lots. // LotStep = 0.50
  4. KBT_Lots_10-100: Buttons 1-0 // 10.00-100.00 lots. // LotStep = 5.00
  5. KBT_Lots_5-50: Buttons 1-0 // 5.00-50.00 lots. // LotStep = 2.50
  6. KBT_Lots-55-100: Buttons 1-0 // 55.00-100.00 lots. // LotStep = 2.50
U : LotStep increment.
Y : LotStep decrement.
Note: The LotsStep Increment/Decrement Value can be customised from the Inputs tab.
  • Other than default allocation, any Lot or LotStep, SL, TP etc., can be customised and saved via the Save button on the Inputs tab.
  • Saved customisation can be loaded via the Load button on the Inputs tab.
  • For ease of efficiency and organisation, incorporate the EA as component of a template.
M : 0.00 lots - Note: This is a safety feature – set Lots to zero when not trading to avoid fat finger accidentals.
}] : 0.01 lots – this is for testing (if required, for whatever reason) if trading at higher than micro lots. If a test is required, one does not want to open 100 lots to run a test. Use – as and when required or not at all. Go figure.

?/ : Buy at Ask – open an order
,< : Sell at Bid – open an order

P : Buy Stop – pending order
L : Sell Stop – pending order
I : Buy Limit – pending order
J : Sell Limit – pending order

R : Reverse - all open orders
Z : Close All - open orders
B: Close All Buy - open orders
S: Close All Sell - open orders
C : Cancel All - pending orders

E : Move Stop Loss to Break Even (BE)
Note: Break Even Offset can be customised in the Inputs tab. Default = 0;
1) BUY & SELL Orders: if BE Offset = 0, BE = Order Open Price.
2) BUY Orders: if BE Offset > 0, BE = Order Open Price plus BE Offset in points.
3) SELL Orders: if BE Offset > 0, BE = Order Open Price less BE Offset in points.

A : Toggle On/Off AutoTrading
T : Toggle On/Off Terminal Window

F : Screenshot >> Broker Name – Symbol – Y.M.D – H:M:S.
Screenshot-1.png

Note: Button F – the screenshot function works perfectly on Linux, but fails on Windows 10 & 11. As previous mention, I cannot be bothered with Windows shite.
Check around there are screen capture indicators available.

Screenshot Location : This in Linux – Wine C Drive (Windows will be similar)
Note: For ease and speed of access individual MT4 Terminal Folders and File can be added to File Explorer Favourites, both in Linux and Windows.
Screenshot-2.png


KEY to Status Text
Screenshot-3.png

These separate values are easily remembered or figured out – the trade closed out on TP before I could get a screenshot – its bog straight forward.

4.00 : Lots
50 : SL in points
300 : TP in points
828.76* : Required Margin with respects to Lots Value x Leverage (base currency margin rate) x Exchange Rate (to deposit currency)*
101,292.64 : Account Equity
101,292.84 : Account Free Margin
** $0.0 : Account Profit.

** Account Deposit Currency: The EA should auto detect the following account deposit currencies: $, £, € and ¥.
Custom account deposit currency symbols - other than the above four auto detected currencies - can be set from the Input in Account Currency Symbol.

* NOTE: STRESS TRIGGER WARNING FOR THE UNEDUCATED:
  1. If this margin value does not correspond to the margin value against the relevant lot value in the MT4 terminal (Ctrl+T, or, T for the EA), then your broker has not translated "Required Margin" from “Base Currency” to “Deposit Currency”.
  2. Lets bounce that again - your broker has not translated "Required Margin" from “Base Currency” to “Deposit Currency”.
  3. MT4/5 brokers are at liberty to set a whole range of terminal specifications to their own choosing – there is no central exchange standardisation.
  4. MQL4/5 code can only read certain specifications as set by the broker.
  5. To get around the broker's lazy sloppy shit requires some serious magic which has its own problems when distributing. F-it, while a welcomed free, charity is a bridge too far.
  6. As a trader, you should know your craft and be able to calculate margins yourself to ascertain and verify correct values. But then again, some will conclude that they, along with their bag of weed, are going to burn the town. I don't doubt and applaud, but it's not for me.
  7. Posts #4 & #5 https://www.trade2win.com/threads/ma...2/post-3268785
  8. More advanced: https://www.forexfactory.com/thread/...7#post13046957
If any errors are bought to light I will – pending available time – investigate correction. Though - I primary run Linux and not really interested in Windows 10 & 11 problem BS.

Downloads: See next post
 
Last edited:
TEST THOROUGHLY ON DEMO
Screenshot from 2025-03-01 20-51-35.png

Note: EAs are tick reliant for operation. If testing in slow markets when ticks are slow (or closed markets, no ticks - limited operation testing), enlist the help of a free tick generator: MT4Ticker: https://fx1.net/mt4ticker.php

NOTE: ENSURE THE FOLLOWING AFTER EA INSTALLATION

Right-click chart > Expert Advisor >> Properties >> Common tab
Screenshot from 2025-03-01 07-33-24.png


Tools > Options > Expert Advisor tab
Screenshot from 2025-03-01 07-33-46.png
 

Attachments

Location of origin.txt file
  1. The origin.txt will reveal which broker is associated with the long Alpha Numerical Terminal Number.
  2. The origin.tex file can be renames as BrokerA.txt, BrokerB.txt, etc.,etc., for ease of Identification
This is the Linux file structure - Windows with be matching similar (start in C:>>Users >> ...)

Screenshot from 2025-03-02 06-07-47.png
 
Trendline and Horizontal Line Alert

Location of Trendline and Horizontal Line tools
Screenshot from 2025-03-18 23-48-14.png

Horizontal Line tool & Trendline tool on chart
Screenshot from 2025-03-18 23-47-08.png

Alert Options:
  1. OFF
  2. Sound Only
  3. PopUp
  4. Mobile
  5. PopUp & Mobile
Alert Modes
  1. Once Per Bar
  2. Every Price Cross
Note: Price is calculated as (Ask+Bid)/2 or middle of Spread.
If spread = 0, then (Ask+Bid)/2 = (Ask=Bid) or (1+1)/2 = 1. Go figure.

Downloads:
THA-3.png

  • Trend_HLine_Alert_1.ex4: default setting - Alert Once Per Bar
  • Trend_Hline_Alert_X.ex4: default setting - Alert Every Price Cross
 

Attachments

Last edited:
How to change the Alert sound (or other event sounds)
  • The default Alerts sound (alert.wav) is irritating - alert2.wav, other sound or added custom sound is more tolerable.
Screenshot from 2025-03-19 09-54-05.png

Select Events tab
Do not select a sound file from the Options/Event tab drop-down list - it will not work.
Click Choose other to open the Open window.

Screenshot from 2025-03-19 09-44-35.png


Select a sound file from the drop-down list in the below Open window
Screenshot from 2025-03-19 09-47-28.png

Note: the last sound file in the list is an added custom file - added custom files must be in .wav formate

Location of Sounds folder (this is on a Linux system but Windows will be similar - if unable to locate see internet, YouTube, ChatGPT, Perplexity, DeepSeek, etc., etc.
Screenshot from 2025-03-19 09-49-04.png
 
Last edited:
A Tick: represents the smallest price movement that a security can make in the market - in other words the smallest price movement = broker minimum Volume Step.
MT4Ticker
: https://fx1.net/mt4ticker.php (works in Windows 10, 11 & Linux)

MT4Ticker is a - free - tick generator:
  1. A tick generator is a tool used in trading platforms like MetaTrader 4 (MT4) to simulate tick-by-tick data for backtesting or analysis purposes.
  2. Unlike real market ticks, which represent the smallest price movement of a trading instrument, a tick generator creates synthetic ticks based on historical data or predefined parameters.
Ignore: I want to try it
Screenshot from 2025-03-16 17-34-39.png


Screenshot from 2025-03-16 17-35-32.png
 
KeyBoard Trader: Update - Input text select options
Screenshot from 2025-03-19 23-12-46.png

Key G: Toggle text options

All Key functions - post #1 : https://www.trade2win.com/threads/keyboard-trader.242964/post-3269716


EA developed using compact UK Keyboard: [ M = 0.00 lots ] , [ <, = Sell ] , [ ?/+ = Buy ]
UK KB.png


All instances of the Expert Advisor are of the same core KeyBoard Trader EA code.
Only the diference is the default lot sizes allocated to the number keys 1,2,3,4,5,6,7,8,9,0.
This, merely as convenience, according to lot preference or use.
  • A Tick: represents the smallest price movement that a security can make in the market - in other words the smallest price movement = broker minimum Volume Step.
  • Note: EA are dependent on incoming ticks - states will only change when a tick has triggered a response to the Key press.
  • Note: EAs are tick reliant for operation. If testing in slow markets when ticks are slow (or closed markets, no ticks - limited operation testing), enlist the help of a free tick generator:
  • MT4Ticker: https://fx1.net/mt4ticker.php (works in Windows 10, 11 & Linux)
👉 SEE ABOVE - NOTE: ENSURE THE FOLLOWING AFTER EA INSTALLATION: https://www.trade2win.com/threads/keyboard-trader.242964/post-3269717
 

Attachments

Last edited:
Back
Top