I've searched the site and evidently mouse clicks can't be captured; has anyone found a work around to do this?
Oddly enough, I posted something about this today: 'Subclassing a Metatrader chart window'
Oddly enough, I posted something about this today: 'Subclassing a MetaTrader chart window'
Wow... you guys are into some serious stuff...I'm just happy to blunder through the code for a simple EA.
I was optimistically trying to create a script which could be used to calculate and display price bertween any two points on the
screen, this is a really common tool elsewhere and I'm surprised it's not available here.
Also seems that somewhere I was reading about a function which returned the location of an object which was dragged and dropped on the screen.
Alas, once again i can't find it in this maze of misinformation.
nuff said ... thanks for your reply
Keith
Wow... you guys are into some serious stuff...
You make us sound like drug addicts...
I was optimistically trying to create a script which could be used to calculate and display price bertween any two points on the
screen, this is a really common tool elsewhere and I'm surprised it's not available here.
You're not the only one who's surprised.
Also seems that somewhere I was reading about a function which returned the location of an object which was dragged and dropped on the screen.
I guess you're talking about WindowXOnDropped() and WindowYOnDropped(). These functions seem to be completely pointless. There doesn't seem to be any way of converting the co-ordinates into a time and/or price - yes, you can use WindowPriceOnDropped() etc, but there's no way of converting the Y co-ordinate from WindowYOnDropped() into a price, so why does WindowYOnDropped() exist?
I feel as though there must be an obvious answer which I'm stupidly missing...
You make us sound like drug addicts...
You're not the only one who's surprised.
Also seems that somewhere I was reading about a function which returned the location of an object which was dragged and dropped on the screen.
I guess you're talking about WindowXOnDropped() and WindowYOnDropped(). These functions seem to be completely pointless. There doesn't seem to be any way of converting the co-ordinates into a time and/or price - yes, you can use WindowPriceOnDropped() etc, but there's no way of converting the Y co-ordinate from WindowYOnDropped() into a price, so why does WindowYOnDropped() exist?
I feel as though there must be an obvious answer which I'm stupidly missing...
Hey... no slur intended.. though I do suspect that repeated exposure to MT4 will drive one to "serious stuff"
And thanks for the info, means I was not hallucinating from the serious stuff... just lost track of the WindowPriceOnDropped() function in the
recesses of my alzhiemers impaired brain.
And i think it might just work, have to figure out how to record two seperate mouse clicks... not too sure if global variables will persist between clicks.
soon as I get rid of my current migraine I'll start on this project.
Thanks again
Keith
I've searched the site and evidently mouse clicks can't be captured; has anyone found a work around to do this?
Failing that, is there any way to get the co-ordinates of a trend line that has been drawn manually?
The time co-ordinate is obviously given by the current bar, but I can't figure any way to get the price component.
Ideas, wild gueses, suggestions, hunches and workable solutions all gratefully accepted.
Keith
Hey... no slur intended..
None taken. I was joking about the drugs stuff.
just lost track of the WindowPriceOnDropped() function [...] not too sure if global variables will persist between clicks
Global variables will do what you seem to be after - although in a really, really cumbersome way.
Personally, I'm still stuck on the fact that WindowPriceOnDropped() is reasonably useful, but WindowYOnDropped() has no obvious purpose whatsoever. If I could work out a way of getting price and time values for any mouse co-ordinates, then I could use my subclassing code ('Subclassing a Metatrader chart window') to allow things like double-clicking on a price to place a pending order there, double-clicking on a historic bar to place a pending order at its high or low etc. I don't actually have any immediate personal use for this stuff, but having spent an hour or two getting it this far it's now maddening that it can't be taken to the obvious next step.
None taken. I was joking about the drugs stuff.
Global variables will do what you seem to be after - although in a really, really cumbersome way.
Personally, I'm still stuck on the fact that WindowPriceOnDropped() is reasonably useful, but WindowYOnDropped() has no obvious purpose whatsoever. If I could work out a way of getting price and time values for any mouse co-ordinates, then I could use my subclassing code ('Subclassing a MetaTrader chart window') to allow things like double-clicking on a price to place a pending order there, double-clicking on a historic bar to place a pending order at its high or low etc. I don't actually have any immediate personal use for this stuff, but having spent an hour or two getting it this far it's now maddening that it can't be taken to the obvious next step.
I was joking too...perhaps better leave that aside before people start to get too interested....
It works:
double drop_price=WindowPriceOnDropped();
datetime drop_time=WindowTimeOnDropped();
//---- may be undefined (zero)
if(drop_time>0)
{
ObjectCreate("Dropped price line", OBJ_HLINE, 0, drop_price);
ObjectCreate("Dropped time line", OBJ_VLINE, 0, drop_time);
}
This is copied right out of documentation and needs at least one more parameter according to the compiler,
ObjectCreate("Dropped price line", OBJ_HLINE, 0,0, drop_price);
ObjectCreate("Dropped time line", OBJ_VLINE, 0, drop_time,0);
Dragging this script onto a chart draws the vertical and horizontal lines.
The rest of the routine shouldn't be too bad, need to generate unique line names for each use, need to do the calcs for price difference.
Need to draw short line between two points, need to display price spread on screen.
All sounds doable to me.
Hey jjc; does this mean you can do your stuff as well?
Hey jjc; does this mean you can do your stuff as well?
No, I need to be able to get price/time for any mouse co-ordinate, not just the co-ordinates at which an indicator/script/EA was originally dropped on the chart. To put it another way, the existence and usefulness of WindowPriceOnDropped() doesn't explain the pointlessness of WindowYOnDropped().
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've searched the site and evidently mouse clicks can't be captured; has anyone found a work around to do this?
Failing that, is there any way to get the co-ordinates of a trend line that has been drawn manually?
The time co-ordinate is obviously given by the current bar, but I can't figure any way to get the price component.
Ideas, wild gueses, suggestions, hunches and workable solutions all gratefully accepted.
Keith