The ones I am familiar with are;
- Expert Advisor->Properties (the typical pop-up window we use)
Double click a script which may or may not asked a question(s)
Hot keys used to assign an EA, script, or indicator (right click on the script and select "Set hot key"). So if you assign a script called "close_pending" to Alt-C, when you hit Alt-C the script executes.
Add something like the code below to your EA to use keyboard input;
Code: Select all
#import "user32.dll"
bool GetAsyncKeyState(int nVirtKey);
#import
#define KEYEVENTF_EXTENDEDKEY 0x0001
#define KEYEVENTF_KEYUP 0x0002
#define VK_P 80
#define VK_Q 81
#include <stdlib.mqh>
#include <stderror.mqh>
#include <WinUser32.mqh>
The dll isn't great because some traders don't want to load in a dll if they aren't sure what it's all about. Also, I've noticed it it isn't perfectly stable due to the incoming ticks not always being present.
I guess I started to toy around with this because I was looking for a "one shot" input to the EA. For example, I wanted to reset a stop back to a previous level with a confirmation pop up box, I don't think I can do this with EA code and the properties box (even if I could figure it out it is operationally clumsy).
I used the code above to allow user input with the keyboard.....
When the user presses Q and P together I have a pop-up fire off but when ticks are few, and the "Yes" button is clicked, the answer isn't always respected by the EA. This is how I currently reset a stop to previous value, in one of y EA's.
So I`m going to move away from this dll, now I will code the reset stop to previous location`` with a script and a hot key..... unless you guys have any better ideas....