Hello
I wish to write an that will read how many candles back from the last one the candles where the mouse is and repeat a given code that uses the time ,every time the mouse moves.
Can someone provide me an example?
Thank you
See CHARTEVENT_MOUSE_MOVE
Thank you for your response.
Are you able to provide an example as I am unable to follow the instunctions shown in the help manual regarding this feature and OnChartEvent.
Thank you
Thank you for your response.
Are you able to provide an example as I am unable to follow the instunctions shown in the help manual regarding this feature and OnChartEvent.
Thank you
You will get a lot of alerts. Think how many pixels there are on your screen. You want an alert every time the mouse moves a pixel.
I've modified your request slightly to show the open price in the Comment, and only on a different bar.
const long &lparam,
const double &dparam,
const string &sparam)
{
static int iLast=-1; // the index of the last bar the mouse was on
if(id==CHARTEVENT_MOUSE_MOVE) // if the mouse moves
{
int x=(int)lparam, // store the x coordinate
y=(int)dparam; // store the y coordinate
datetime when;
double price;
int subwin=0;
ChartXYToTimePrice(0,x,y,subwin,when,price); // convert x/y to time/price
int i=iBarShift(NULL,0,when); // find out which bar the mouse is on
if(i!=iLast) Comment(Open[i]); // if it is a different bar, alert with the open price
iLast=i; // remember the bar index for next time
}
}
You will get a lot of alerts. Think how many pixels there are on your screen. You want an alert every time the mouse moves a pixel.
I've modified your request slightly to show the open price in the Comment, and only on a different bar.
const long &lparam,
const double &dparam,
const string &sparam)
{
static int iLast=-1; // the index of the last bar the mouse was on
if(id==CHARTEVENT_MOUSE_MOVE) // if the mouse moves
{
int x=(int)lparam, // store the x coordinate
y=(int)dparam; // store the y coordinate
datetime when;
double price;
int subwin=0;
ChartXYToTimePrice(0,x,y,subwin,when,price); // convert x/y to time/price
int i=iBarShift(NULL,0,when); // find out which bar the mouse is on
if(i!=iLast) Comment(Open[i]); // if it is a different bar, alert with the open price
iLast=i; // remember the bar index for next time
}
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I wish to write an that will read how many candles back from the last one the candles where the mouse is and repeat a given code that uses the time ,every time the mouse moves.
Can someone provide me an example?
Thank you