I'm looking to detect event of dragging trade level WHILE dragging. I have written indicator replacing standard trade levels with custom
HLINES. I do imitate level dragging by using
attached
code, but the solution is not elegant, takes more resources than necessary and triggers on every mouse move with button clicked,
not only on trade level drag. I would appreciate if someone comes up with a better idea.
voidOnChartEvent(constint id,
constlong &lparam,
constdouble &dparam,
conststring &sparam)
{
//---if(showLevelOnDrag && id==CHARTEVENT_MOUSE_MOVE && MathMod(StringToInteger(sparam),2)>0)
{
int x =(int)lparam;
int y =(int)dparam;
datetime time=0;
double price=0;
int window=0;
ChartXYToTimePrice(0,x,y,window,time,price);
CreateLine(9999999999999999,LEVEL_MV,price,clrDimGray,0,STYLE_DASHDOT); // creates or moves the line
}
elseif(showLevelOnDrag && ObjectFind(0,GetNameForLevel(9999999999999999,LEVEL_MV))>=0) ObjectDelete(0,GetNameForLevel(9999999999999999,LEVEL_MV));
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I'm looking to detect event of dragging trade level WHILE dragging. I have written indicator replacing standard trade levels with custom HLINES. I do imitate level dragging by using attached code, but the solution is not elegant, takes more resources than necessary and triggers on every mouse move with button clicked, not only on trade level drag. I would appreciate if someone comes up with a better idea.