| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Hot keys, keyboard input, user input... https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=177 |
Page 1 of 2 |
| Author: | AnotherBrian [ Wed Dec 21, 2011 2:13 am ] |
| Post subject: | Hot keys, keyboard input, user input... |
Since this is a coders forum, I'd like to discuss the different ways of getting user input into an EA, such as from a keyboard or other device. The ones I am familiar with are;
Code: Select all 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.... |
|
| Author: | RedLineFred [ Mon May 20, 2013 2:54 am ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
Brian, Did you manage to get any further on this one? I am toying with the keyboard entry code and have managed to receive input, but my problem is that as my EA is running on various pairs (charts) I cant seem to direct the keyboard entry to the chart i am looking at. The input is applied randomly across all incarnations of the EA running at the time. Have you figured out a way to stay focussed on the one chart? so that any input is limited to the chart currently on view? cheers, Fred |
|
| Author: | gaheitman [ Mon May 20, 2013 11:26 am ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
You need to have your code check and see if the window it is running in is actually the active window. If it isn't, it needs to ignore keyboard input. Check out the code here: http://www.forexfactory.com/showthread. ... ost5803610 George |
|
| Author: | AnotherBrian [ Mon May 20, 2013 4:21 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
I stopped using keyboard input - one of the main reasons is that you need a tick to trigger it, and you finger needs to stay on the keyboard (from what I recall). I see some others have put buttons on the screen, to activate you move the object with your mouse, the code detects this. |
|
| Author: | RedLineFred [ Tue May 21, 2013 2:13 am ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
Thanks gentlemen, appreciate your responses, and will try both the code George points to and the mouse over idea. |
|
| Author: | RedLineFred [ Wed Jun 19, 2013 1:55 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
I've had some success with the mouse button idea, but I have run into a slight problem and was wondering if there is a solution. It comes back to the chart updates being applied on the next tick. While ok it would be great to have my code segment executed sooner, so that its ready for action when the next tick comes in rather than wait. Has anyone got a solution for forcing a start() without a tick, say every 1sec? The idea of continuously looping sounds too resource intensive. |
|
| Author: | AnotherBrian [ Wed Jun 19, 2013 7:09 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
Don't leave the start function. I don't know how to do that, or what the new issues would be but I've read that somewhere. |
|
| Author: | gaheitman [ Wed Jun 19, 2013 7:24 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
Just have a while loop in your start() procedure. Something like: Code: Select all George |
|
| Author: | RedLineFred [ Wed Jun 19, 2013 8:22 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
George, could you elaborate on how to generate fake ticks as it sounds like the way to go. |
|
| Author: | gaheitman [ Wed Jun 19, 2013 8:58 pm ] |
| Post subject: | Re: Hot keys, keyboard input, user input... |
I use offline range bar charts, so my needs aren't exactly normal. I use the attached script on the main chart and have it send ticks to the offline 4M chart that holds my range bars. There is an external program floating around that will send ticks as well, that others swear by. I'll see if I can find that one as well. (FOUND IT: http://www.stevehopwoodforex.com/phpBB3 ... f=47&t=337) This works for me, but your mileage may vary.... George |
|
| All times are UTC | Page 1 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|