Are mouse clicks in PowerLanguage important?

Questions about MultiCharts and user contributed studies.
User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 27 Jan 2012

Please tell us if this functionality can give you some benefits and how you are going to use it. Thanks

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

Please note that this mouse click event is implemented by TS 9.1 already.

- there are 2 events - one down & one up event
- with several key combinations and mouse clicks - one can detect and act what is intended operation

few of the tasks I can think of:
- click on a price (control+left click) - would generate the "signal" to a conditional buy order - this would be an input to a strategy and to enter long - certain events needs to happen and if those events happen - a long order would be generated at or around that price.

- might want to calculate certain values (like cumulative delta) from the bar that is clicked on and can be fed to another strategy or so.

Thanks.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Are mouse clicks in PowerLanguage important?

Postby furytrader » 27 Jan 2012

Yeah, it would be cool to be able to capture where and how a user clicks on a chart.

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

it's also important to return the BarNumber as part of the mouse click event. There are occassions - maxbarsback is going to cause issues and this needs to be carefully examined to make sure there is unique bar number returned to the mouse event handler.

User avatar
furytrader
Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Are mouse clicks in PowerLanguage important?

Postby furytrader » 27 Jan 2012

Yes, bar number and relative price level

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 27 Jan 2012

vking wrote:it's also important to return the BarNumber as part of the mouse click event. There are occassions - maxbarsback is going to cause issues and this needs to be carefully examined to make sure there is unique bar number returned to the mouse event handler.


You are correct maxbarsback affects the effective bar number so I don't believe it is a good way to go. I think we should return date/time since it is consistent. What do you feel about it?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

Unfortunately - just the date/time is not going to solve this issue. For tick bars(specifically very small time frame) same time stamp is likely to be with multiple bars.

TS is thinking of taking out maxbarsback out of this control and potentially might come up with a full solution to this issue - which would give the exact barnumber that can be used.

I don't know the full details of why maxbarsback is used and can't be taken out completely - so can't speak on that - but if there is any possibility - maxbarsback should be taken out completely. barnumber should be unique to all studies/strategies/any events.

Thanks



Andrew Kirillov wrote:
vking wrote:it's also important to return the BarNumber as part of the mouse click event. There are occassions - maxbarsback is going to cause issues and this needs to be carefully examined to make sure there is unique bar number returned to the mouse event handler.


You are correct maxbarsback affects the effective bar number so I don't believe it is a good way to go. I think we should return date/time since it is consistent. What do you feel about it?

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 27 Jan 2012

Could you give me the TS9.1 script that uses down & one up events?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

at this point - this is one event ( one click). Up/down events are going to be seperated out very soon ( 9.1 is still beta at this time and few releases are going on. One of the versions are likely to have these 2 events separated out).

if it helps - they have also introduced - customizable - buttons (this is huge feature)- one can program and use for trading - unlike fixed buttons in other platforms including MC.

Thanks

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 27 Jan 2012

vking wrote:at this point - this is one event ( one click).

Could tell me the name? I can't find it to be honest:) Thanks.

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 27 Jan 2012

vking wrote:customizable - buttons (this is huge feature)

How does it work?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

basically - you can program it to do - like - "select a price" - and go long - if few events happen there. That can be programmed into a button.

"select" price - and scale-out - if certain events happen at that price - and can be program into that button.

Basically - you are specifying button specific easy language code.

Gives new dimension to semi-automated trading. This is really an awesome feature and well thought out.

Andrew Kirillov wrote:
vking wrote:customizable - buttons (this is huge feature)

How does it work?

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 27 Jan 2012

send you through PM.

Andrew Kirillov wrote:
vking wrote:at this point - this is one event ( one click).

Could tell me the name? I can't find it to be honest:) Thanks.

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: Are mouse clicks in PowerLanguage important?

Postby SP » 27 Jan 2012

Andrew,

i like to have a buttom to toggle an indicator on/off with one click to convert a Bid/Ask/Delta study for NT to MC.

http://www.bigmiketrading.com/elite-cir ... #post93383

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Are mouse clicks in PowerLanguage important?

Postby bowlesj3 » 29 Jan 2012

With regular charts date and time would be useful since the binary searches can be used to get the offset.. With tick charts, If bar number is returned, although I have never done it, I am assuming we can calculate the offset from currentbar and use that to get the date and time. From that the user could search both forward and backward to get the first and last tick bar with that date and time.

I am assuming that there is a command in the study to detect the mouse click. If this is true then the user might click several clicks before the study is executed. Yes we could use that command that can be used to execute the study every second but is that going to be enough. If not can we have it set up so that the mouse click triggers the execution of the study. So in other words add it to this request. "More methods to execute a study." which already has 13 votes.
https://www.multicharts.com/pm/viewissue ... _no=MC-423
So if the study tab that has "Execute on every tick" has other check boxes added for other methods of executing this study then there would be a check box there for "execute on mouse click".

The above idea brings up the idea of executing a study on a button click and allowing that button click to be put on a custom tool bar as per this request.
https://www.multicharts.com/pm/viewissue ... _no=MC-424

Right now I have about 50% of my studies execute specific code if text or arrows or lines are highlighted. The MC_arw/text/tl_getactive commands are used. Here is an example of a base script to get started on making use of these commands.
viewtopic.php?f=5&t=7764&hilit=binary

So it seems there are lots of ways of looking at this idea. If the program can detect if a bar is clicked and there is a check box for "execute on mouse click" is it a good idea to have a popup that allows us to decide what the program should make a available (bar number, offset, date/time, whatever). I am thinking in terms of barnumber being easier and having the other items unchecked would help make this study run faster.

Getting back to Andrew's question at the top, when I first got MC I wanted to be able to get the data from where I had the cursor located. I asked for a feature of a button click to grab that data. Later when I realized that arrows on the chart could be inspected for their location I realized this was a much better method. I wanted the data so I could mark the tops and bottoms of multiple levels of waves for my trading system (all the rules were not even finished at that time). Having arrows gave me a visual record of where I had marked the waves as I saw them. I felt that programming code to find multiple levels of waves was just far too difficult a programming task. So I wrote code to create sets of arrows (two sets per chart). These are located on the 10 second bars, 1 minute bars, 5min, 10min, 30min and 60min. For my system in the end I use them all but generally the primary use ones are only the ones up to the 5 minute bars. It depends on the market structure. I often rework them (really fast). In other words I may take them off the 5 minute bars and put them on the 10 minute bars in a slightly different location and have that done within 60 seconds (that is 3 wave tops and 3 wave bottoms all within 60 seconds). You could never do this if the only way you had to mark waves was with a mouse click with no way of keeping a visual record of the wave tops and bottoms. I have other arrows I drop on the chart randomly as well to enter data and I want a record of where I did it. I also come back to them and re-highlight them and use the MC_Arw_GetActive command to get the data from them. So for me, because I already have my system 99% done (I always find a way to make it faster etc) and I use the arrows I am not sure I would use this feature. However it would be handy to be able to run a study by clicking a button only or run it when I click a text on a chart or something. Right now I have a study that runs based upon the example in the link above and it detects when the text is highlighted rather than being run when I click the text. Maybe if this feature was there I could change it to only run when I click the text. Here is the problem. If the study runs only when I highlight the text (as detected by the mouse click on that specific chart) then the MC_Text_GetActive command needs to occur just after that and determine if this text had actually been highlighted. I am not sure how this would work timing wise. If the purpose of running this study is to reduce the amount of times it runs during the day then maybe a method of turning a study off is needed until the next mouse click on that chart. So in other words the sequence would be, mouse click wakes the study up, the study checks for MC_Arw_GetActive and if there is one highlighted as a result of this mouse click then it runs some code then once that is done it turns off again (so that no ticks cause it to be run). If it is flagged as only to be run on mouse clicks then this would solve the shutting it off problem. On the other hand, the scripts that control the arrows for the waves are different. They have to be running tick by tick because they detect breaks and stalls in the waves and send the data over to my control program where I get pop-ups etc. I now have them run a minimum of every second using that new command. Much like the text highlighting example I just mentioned above, I am asking myself if a study could be run only when a random arrow in the RSI is clicked (highlighted) and just after running I could test to see which one is active using MC_Arw_GetActive. Maybe this could be used but I would have to think about it (even try it, test it). I should note that the main reason I have asked for the ability to put predefined drawings on a custom tool bar is so I can have different colours of arrows defined and quickly get them on a chart so I can have the MC_Arw_GetActive detect an arrow is active and then use the colour to know which code needs to run. Right now for situations where a new arrow is going on the chart they are always one fixed color and it is not practice to change the color during live trading (way too slow).
These users thanked the author bowlesj3 for the post:
arjfca

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Are mouse clicks in PowerLanguage important?

Postby bowlesj3 » 30 Jan 2012

After underlining the text in the prior post, and giving it some more thought, it occurred to me that if the mouse up click was detected by a study and if the study was also checked to be executed at that point it could execute MC_Arw_GetActive to see if a specific arrow is still highlighted then it could check to see if it has been moved. Right now my arrows script that marks the waves checks on every single tick to see if any of the 6 arrows have been moved. it checks against values stored in GVs so that if MC goes down and I bring it back up the arrows go back to the positions they were at before MC went down. So by having the script forced to execute this code as a very high priority it could get at this code before I have a chance to highlight the chart background and remove the highlight on the arrow. I say this because I at times move the whole set of six arrows in sequence very very quickly if I have decided that the market structure is different than I initially analyzed it. I estimated a minute. It is probably more like moving them all within 10 seconds. So I am not sure if running the code on the mouse up click would be fast enough or not. But regardless that is one use for the mouse up click event. Having given it a bit more thought, if MC is too slow I could have it check all 6 arrows for movement every time there is an up click event and do not bother to check to see if there is one active (meaning skip using MC_Arw_GetActive). So this would save having to loop all 6 arrows on every single tick as I do now. It could be a significant savings in processing time since I often have about 6 sets of arrows active on all the charts.

I think I mentioned in this post
https://www.multicharts.com/pm/viewissue ... _no=MC-423
that the scripts should be able to detect the method by which they were being called. So I guess the field which shows this would have to indicate mouse down event or mouse up event (assuming these were checked as methods to execute this study). However, what if the study was being called by a tick and an up click event at the same time. So I think you need to have a field for each method the study is being called. If the tick call for execution was the only one showing then my code might miss the fact that I had moved an arrow.
Last edited by bowlesj3 on 31 Jan 2012, edited 1 time in total.

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

Re: Are mouse clicks in PowerLanguage important?

Postby ABC » 31 Jan 2012

In my opinion this would be a very useful feature, if for example you can do things with it you can do in TS with the Commentary option.
This means it would be useful for debugging and from a trader's point of view you can use it to start stops and targets from a specific bar for example.
These users thanked the author ABC for the post (total 2):
TJarjfca

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Are mouse clicks in PowerLanguage important?

Postby bowlesj3 » 31 Jan 2012

It has a lot of uses especially if it can pick up info from the cross hair location.
viewtopic.php?f=5&t=7764&hilit=binary
At the same time the above script could be modified for trend lines and a horizontal target and stop line could be floating out front of current price (inactive target/stop/entry) and back of price (active target/stop/entry). The script would detect the lines being moved during left mouse button down and locate them during left mouse button up using MC_TL_GetActive to determine if these were the lines that had been moved.
These users thanked the author bowlesj3 for the post (total 2):
TJarjfca

arjfca
Posts: 1282
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: Are mouse clicks in PowerLanguage important?

Postby arjfca » 01 Feb 2012

Could we vote for this click option
Could I cheat and vote twice

In French we say "Jamais deux sans trois"..... If I did vote twice, maybe I could vote a third time. :)

Did I say that I would like to have it? A good day to all

Martin
Montreal, Canada

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Are mouse clicks in PowerLanguage important?

Postby bowlesj3 » 01 Feb 2012

I would say that if the user has left clicked down and not clicked a tool (if that can be immediately determined) then that would normally be when they want the bar info. I don't think they should have to click directly on the bar. If the backward offset (distance from current bar) is returned they can get anything (bands, RSI, any indicator). In this situation I think the info should be provided even if they are not directly on the bar. If they are using a cross hair it is easy to determine. Come to think of it the user can not determine if a tool is clicked or not since most of the tools have not MC_???_GetActive command anyway. So maybe there needs to be a way to determine if a tool is left clicked or not. Maybe some users would like to know if certain other tools have been highlighted.
These users thanked the author bowlesj3 for the post:
arjfca

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 01 Feb 2012

Based on how this is being implemented in TS - this is NOT associated with studies ( or atleast the initial implementation). They are just the events - and the event handlers needs to be coded into the indicators/signals themselves. There can be different keys associated to distinguish what the user wants.

for example - if I press - ctrl+left click some where on the chart - event handler should just return the bar ID as part of event handler - If I use ctrl+left mouse - I might want to enter a long order on high of the bar or low of the bar etc ( fully controllable in the signal code).

similary - if I press alt+left click - I might want to feed some input to an indicator etc. This event ( alt+left click event handler should be coded into indicator).

In the indicator - I would have to determine - if there was any event handler - what was the bar information - do I have to do anything with it etc?

PS: I am not against using this with all the studies - but just saying based on how the initial implementation is being done in TS(the way I understood) - which is slightly less cumbersome as a starting point - if this route is taken.

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Are mouse clicks in PowerLanguage important?

Postby bowlesj3 » 01 Feb 2012

Hi vking,

I think what you are describing is exactly what I am describing. The only difference is I was not including any keys in addition to the method (whatever that may be) that the study would detect that the mouse clicks had occurred (both down and up).

The only thing that I added was the ability to have the study execute on such events so that it would not miss multiple very fast clicks of the left mouse button (even 1 second execution may not be fast enough). In my mind if the mouse click can not force the execution of a study (multiple studies) then the idea is not that great. If, for example, 3 studies were checked off to be executed on a mouse event (both up and down lets say), then each one would likely have different things it was looking for. One might be looking for bar info. Another might be looking to do something else with added keys as you describe and another may be looking to see if a specific tool had been moved or maybe still is highlighted. Maybe there could be a way to detect that a plot has been highlighted some day and the user may have been using this as an entry point for example.

John
These users thanked the author bowlesj3 for the post:
vking

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby Andrew Kirillov » 03 Feb 2012

We do appreciate the comments. We will consider all suggestions. The basic mouse click functionality is already implemented and will be available soon.

vking
Posts: 235
Joined: 21 May 2009
Has thanked: 51 times
Been thanked: 41 times

Re: Are mouse clicks in PowerLanguage important?

Postby vking » 26 Feb 2012

Hello MC Team - Now that this feature is implemented - wondering if there are any examples that can be provided as the help section seems to be missing in this area.

Thanks.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1527 times
Been thanked: 1502 times
Contact:

Re: Are mouse clicks in PowerLanguage important?

Postby JoshM » 27 Feb 2012

vking wrote:Hello MC Team - Now that this feature is implemented - wondering if there are any examples that can be provided as the help section seems to be missing in this area.

There's a little help here: MouseClickEvents, but no real examples yet.
These users thanked the author JoshM for the post:
vking


Return to “MultiCharts”