Mouse over a bar: Is there a function to capture the info  [SOLVED]

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1260
Joined: 23 Nov 2010
Has thanked: 716 times
Been thanked: 221 times

Mouse over a bar: Is there a function to capture the info

Postby arjfca » 11 Oct 2012

Hello

Is there a function to capture the OHLC of a bar when mouse is over it. I tough that MC8 did include this function, but if so, I don't found it.


The goal is to capture bar data using mouseclick event

Martin

User avatar
ABC
Posts: 516
Joined: 16 Dec 2006
Has thanked: 110 times
Been thanked: 290 times
Contact:

Re: Mouse over a bar: Is there a function to capture the inf  [SOLVED]

Postby ABC » 12 Oct 2012

Martin,

you can use "MouseClickBarNumber" and get the bar values using the Barnumber, but there is nothing that will return all bar values with one click. Only for the date and time of the bar "MouseClickDateTime" offers a direct way.

Regards,
ABC
These users thanked the author ABC for the post:
arjfca

arjfca
Posts: 1260
Joined: 23 Nov 2010
Has thanked: 716 times
Been thanked: 221 times

Re: Mouse over a bar: Is there a function to capture the inf

Postby arjfca » 12 Oct 2012

Hello Chris and others

This code create error Try to reference to a future bar
Also, Mouseclick events seems buggy. Many instance is recorded with a simple click
Once error detected, the indicator is stopped. When tried to restart it, error popup immediatly.
I have seen up to ten popup.

To resolve that, I recompile my code

Code: Select all

[ProcessMouseEvents = True];
Var:

Lastbar (0),
N_ (0),
ClickedBar (0),
Open_ (0),
High_ (0),
Low_ (0),
OHLC_STR (""),
Close_ (0),
Comma ("");

Once begin
    Comma = ",";
end;
   
if lastbaronchart then begin
   
         OHLC_STR = "";
      Lastbar = currentbar;
      ClickedBar =  MouseClickBarNumber ;
      N_ = lastbar - ClickedBar;
   
      Open_  = Open Of N_ Bar ago;
     High_  = High Of N_ Bar ago;
      Low_   = Low Of N_ Bar ago;
      Close_ = Close Of N_ Bar ago;
   
      OHLC_STR = NumtoStr(Open_,5) + comma + NumtoStr(High_,5) + comma + NumtoStr(Low_,5) + comma + NumtoStr(Close_,5);
       If OHLC_STR  <> "" then    Print (OHLC_STR);
end;


The code returned a printed value that was referencing may many bars ago while i was clicking around 30 bars from the last one on charts

Martin


Return to “MultiCharts”