MouseClickBarNumber

Questions about MultiCharts and user contributed studies.
Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

MouseClickBarNumber

Postby Nick » 06 Jul 2016

Hello,

I'd like to update a variety of my studies to use MouseClickBarNumber to get the starting bar to use for calculations etc.

Is there a way to use this once (or maybe x2 to get startbar endbar) in a study and then turn off processing mouse events for that study?

I'd like to use MouseClickBarNumber with more than one study in a chart to define starting points.

[ProcessMouseEvents = false] appears to be an interpreter directive that disables all mouse input. I guess I'll have to use a flag.

I also presume there is a way to make these 'inputs' persistent without writing files? It might be a nice feature to be able to update an Input: StartBar (1); With a variable under indicator control (got with a mouse click for example).


Thanks.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: MouseClickBarNumber

Postby JoshM » 06 Jul 2016

I'd like to update a variety of my studies to use MouseClickBarNumber to get the starting bar to use for calculations etc.

Is there a way to use this once (or maybe x2 to get startbar endbar) in a study and then turn off processing mouse events for that study?
Mouse events cannot be turned off conditionally; there are either always on or always off. What you can do if you want to use a 'click that registers the start bar' and 'click that registers the end bar' is to use keyboard keys.

For instance, a Control + click marks that bar as the begin bar, and a Shift + click a end bar. More on combining clicks and keys is here: combine mouse clicks and keyboard keys.
I also presume there is a way to make these 'inputs' persistent without writing files? It might be a nice feature to be able to update an Input: StartBar (1); With a variable under indicator control (got with a mouse click for example).
You can use the IntrabarPersist keyword to make variables retain any values that are assigned to them during intra-bar calculations. In other words, with `IntrabarPersist` a variable will always keep the value that's stored in it when a mouse click happen.

Or do you mean persistent over files with your 'inputs' description? That's unfortunately not possible.

Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Re: MouseClickBarNumber

Postby Nick » 06 Jul 2016

Thanks Josh but I don't think that will do what I require.

I am already using shift clicks etc. However the problem is if I have several studies (or multiple instances of the same study) on the same chart. If I shift click it will change all the start points of all I think? Whereas I want (for example) one instance of the study starting on say bar 12 the next one on bar 21 and the final one on bar 50.

As for persistence I should have been clearer I mean persistence between invocation of various studies or even instances of multicharts. For example if I set the start bar for a study from a swing high and have another copy starting from a swing low I'd like those remembered the next time I open that chart. Much like you can change an input parameter on a study and check the 'save as default' check box.

I think the long and the short of it is MC is not really designed for interactive input due to its TS heritage.

I guess I'll leave the studies having start year, month, day, time, inputs though its pretty clunky.

Thanks again for the suggestion, I'm always open to other ideas :)

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: MouseClickBarNumber

Postby JoshM » 07 Jul 2016

I am already using shift clicks etc. However the problem is if I have several studies (or multiple instances of the same study) on the same chart. If I shift click it will change all the start points of all I think? Whereas I want (for example) one instance of the study starting on say bar 12 the next one on bar 21 and the final one on bar 50.
This is not possible, unfortunately, since there isn't a keyword that can tells us which script triggered the calculation after the mouse click.

What you could also do, but this is a very rough workaround, is to have each script make two specifically coloured arrows. Then you can drag the red arrows to signal the first and last bar for script A, while blue arrows highlight the bars for script B. The script can then retrieve the arrow location and compute with it.
As for persistence I should have been clearer I mean persistence between invocation of various studies or even instances of multicharts. For example if I set the start bar for a study from a swing high and have another copy starting from a swing low I'd like those remembered the next time I open that chart. Much like you can change an input parameter on a study and check the 'save as default' check box.
That's unfortunately not possible; not even the 'save as default' checkbox works that nice. MultiCharts is indeed quite focused on 'independent sessions', much like other windows applications.

(If you use arrows or other drawings with the rough workaround mentioned above, then those do keep their location on the chart when MultiCharts closes.)

maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

Re: MouseClickBarNumber

Postby maxmax68 » 07 Jul 2016

Hello Nick,
Is there a way to use this once (or maybe x2 to get startbar endbar) in a study and then turn off processing mouse events for that study?
to achieve this result you could use this workaround:

-To draw on the chart a text box to be used as a switch-flag to turn on-off.
-You click on text button to turn on the flag.
-Then you make your shift+mouse clicks for starting and ending points.
-Then you reclick on text button to turn off the flag.
However the problem is if I have several studies (or multiple instances of the same study) on the same chart. If I shift click it will change all the start points of all I think? Whereas I want (for example) one instance of the study starting on say bar 12 the next one on bar 21 and the final one on bar 50.
this means you need to draw a text box for each study, so if you click on box 1 you change start and ending point of study 1, and so on ...

Nick
Posts: 496
Joined: 04 Aug 2006
Has thanked: 4 times
Been thanked: 24 times

Re: MouseClickBarNumber

Postby Nick » 08 Jul 2016

Thanks for these cunning suggestions! Perhaps more elegant than what I was thinking

My idea was to have a separate study whose sole purpose is to get a bar number. The study could be turned off simply without effecting anything else.

The clunky bit would be that the bar number would have to be manually entered into the 'actual' indicator as an input:. The big advantage of this method would be that the value of the input: can be saved as a default so will be used even after a MC restart.

This begs the question of the best way of displaying the bar number. Simple text on the chart though I was thinking expert commentary might be better.

Thanks again for the suggestions.


Return to “MultiCharts”