Determining sub-chart an arrow is placed on  [SOLVED]

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2104
Joined: 21 Jul 2007
Has thanked: 200 times
Been thanked: 420 times

Determining sub-chart an arrow is placed on

Postby bowlesj3 » 01 Jul 2018

I use to determine if I placed an arrow manually on sub-chart #2 (the RSI sub-chart) by testing the arrow price value is < 200. It worked when trading the E-mini because the price never got that low but it will not work with trading stocks since all the ones I trade are below $100. Might there be a way to determine which sub-chart the arrow is placed on. I just checked the "PowerLanguage_MC10.chm" help file and it does not have a command for this.

I am thinking of using the MouseClickEvents to click on an the subchart #2 to have it determine where to have a script place a trend line on the RSI. I am thinking I might be able to use the MouseClickDataNumber value 2 to determine I am on the RSI chart and use the "TL_New_self" to place the RSI trend line. I could use the MS_Text_GetActive command to determine what the MouseClickEvents are to be used for by highlighting text in the upper sub-chart #2 area. I will store the Coordinates in GVs tied in with the symbol so I can retrieve them the next day or when the scanner displays this chart again.

I guess it is time to start tinkering.
Last edited by bowlesj3 on 01 Jul 2018, edited 1 time in total.

bowlesj3
Posts: 2104
Joined: 21 Jul 2007
Has thanked: 200 times
Been thanked: 420 times

Re: Determining sub-chart an arrow is placed on

Postby bowlesj3 » 01 Jul 2018

I created a script with the MouseClickEvent (shown below). I used the RecalcLastBarAfter(1); to force the commands to execute. I clicked the left mouse button four times on each of the three subcharts and it produces only the values shown at the bottom. It does not seem to work. I am not using .net. Is this the reason?

Code: Select all

{A_Test_MouseClickEvents =======================================================}

inputs:
FutureUse(0);

variables:
LogFile(""),
LogPath(""),
AnotherFutureUse(0);

if currentbar = 1 then
begin
LogFile = "A_Test_MouseClickEvents.txt";
LogPath = "C:\Users\John Bowles\Downloads\" + LogFile;

end;


If (LastBarOnChart = true) then
begin
if MouseClickDataNumber = 2 then
begin
end;
if MouseClickDataNumber = 1 then
begin
end;
if MouseClickDataNumber = 3 then
begin
end;
FileAppend(LogPath,
"here2 " +
" date=" +
numtostr(date,0) +
" time=" +
numtostr(time,0) +
" MouseClickDataNumber=" +
numtostr(MouseClickDataNumber,0) +
" MouseClickPrice=" +
numtostr(MouseClickPrice,0) +
NewLine);
RecalcLastBarAfter(1);
end;
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0

bowlesj3
Posts: 2104
Joined: 21 Jul 2007
Has thanked: 200 times
Been thanked: 420 times

Re: Determining sub-chart an arrow is placed on

Postby bowlesj3 » 01 Jul 2018

I guess I could have a script run on subchart #2 that creates an arrow and after it creates it I could capture the ID of that arrow and put in in a GV with GV_SetNamedInt("RSI_Arrow",ID); Then after I use the MC_Arw_GetActive command I could test to see if the ID matches the ID stored in the GV. This way if I placed any other arrows anywhere they would be ignored. This arrow would be moved into place. I have code already that can be modified for this functionality by my first using MC_Text_GetActive to indicate what the information the arrow is providing is to be used for (horizintal trend line, angle trend line with 2 coordinates, delete the line, etc).

If anyone has an easier way or a solution to the issues mentioned before this idea I wold love to hear them.

User avatar
ABC
Posts: 628
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: Determining sub-chart an arrow is placed on

Postby ABC » 02 Jul 2018

bowlesj3,

your code misses the ProcessMouseEvents attribute and this might explain why it's not working.
https://www.multicharts.com/trading-sof ... ouseEvents

Regards,

ABC
I created a script with the MouseClickEvent (shown below). I used the RecalcLastBarAfter(1); to force the commands to execute. I clicked the left mouse button four times on each of the three subcharts and it produces only the values shown at the bottom. It does not seem to work. I am not using .net. Is this the reason?

Code: Select all

{A_Test_MouseClickEvents =======================================================}

inputs:
FutureUse(0);

variables:
LogFile(""),
LogPath(""),
AnotherFutureUse(0);

if currentbar = 1 then
begin
LogFile = "A_Test_MouseClickEvents.txt";
LogPath = "C:\Users\John Bowles\Downloads\" + LogFile;

end;


If (LastBarOnChart = true) then
begin
if MouseClickDataNumber = 2 then
begin
end;
if MouseClickDataNumber = 1 then
begin
end;
if MouseClickDataNumber = 3 then
begin
end;
FileAppend(LogPath,
"here2 " +
" date=" +
numtostr(date,0) +
" time=" +
numtostr(time,0) +
" MouseClickDataNumber=" +
numtostr(MouseClickDataNumber,0) +
" MouseClickPrice=" +
numtostr(MouseClickPrice,0) +
NewLine);
RecalcLastBarAfter(1);
end;
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295 MouseClickPrice=0

bowlesj3
Posts: 2104
Joined: 21 Jul 2007
Has thanked: 200 times
Been thanked: 420 times

Re: Determining sub-chart an arrow is placed on

Postby bowlesj3 » 02 Jul 2018

your code misses the ProcessMouseEvents attribute and this might explain why it's not working.
https://www.multicharts.com/trading-sof ... ouseEvents
Thanks ABC,

In both the wiki and the help a search of "mouse" and "*mouse*" does not show this command. I think at the bottom of each command a reference to ProcessMouseEvents might be helpful. I guess this is something for TS-Support to think about. It would extend out into other commands and also the functions they supply with MC as well. It would apply to both the help and the wiki.
Last edited by bowlesj3 on 02 Jul 2018, edited 1 time in total.

bowlesj3
Posts: 2104
Joined: 21 Jul 2007
Has thanked: 200 times
Been thanked: 420 times

Re: Determining sub-chart an arrow is placed on  [SOLVED]

Postby bowlesj3 » 02 Jul 2018

Based upon the description of MouseClickDataNumber (shown below) I was hoping that clicking on subchart 2 where the RSI resides would show up and it would show the price of the RSI scale as well. However (based upon my test shown below) it only seems to show up when I click in subchart 1 as my test data below shows.

MouseClickDataNumber
Returns the numerical value indicating the data series number after a mouse click on the data series.

Usage
MouseClickDataNumber

Example
MouseClickDataNumber - will return 1 after left-click on the main chart with the main data series.

MouseClickDataNumber - will return 2 after left-click on the sub-chart with the second data series.
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=1.00 MouseClickPrice=16.940
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=1.00 MouseClickPrice=16.896
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
here2 date=1180628 time=1600 MouseClickDataNumber=1.00 MouseClickPrice=16.821
here2 date=1180628 time=1600 MouseClickDataNumber=4294967295.00 MouseClickPrice=0.000
However I do not think it really matters. My tests show I can still use it. I can use the MouseClickDateTime value to replace the the use of arrows I describe in this link.
viewtopic.php?f=5&t=7764
I will store the last two mousclickdatetime values then (as the link above describes) I will click the letter "A" that the script puts out to indicate I want those two values to be used to place an angle RSI trend line on the chart.
Again (as the link above describes) if I click the text letter "H" that the script puts out it indicates I want the last mousclickdatetime value to be used to place a horizontal line on the RSI subchart.

I need to convert the MouseClickDateTime as follows.
MouseClickDate = JulianToDate(MouseClickDateTime) ;
MouseClickTime = DateTime2ELTime(MouseClickDateTime) ;
Once again (as the link above describes) the code uses MouseClickDate and MouseClickTime to execute a binary search to figure out what the RSI value is at the date and time and the code places the line.

I use MS-Access to store the line coordinates that are placed in GVs by the script. This allows me to store the RSI lines across scanner symbol displays on the charts and across computer reboots.


Return to “MultiCharts”