Hi,
does exist something like Text_GetActive or TL_GetActive for the plots ???
I need to know the number of the active plot when clicked with the mouse on a chart.
Regards
Massimo
PLOT_GetActive ???
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: PLOT_GetActive ???
Such keywords don't exist, as far as I know.does exist something like Text_GetActive or TL_GetActive for the plots ???
I need to know the number of the active plot when clicked with the mouse on a chart.
Why do you need to use the active plot number in your code? Perhaps we can think of a workaround.
Re: PLOT_GetActive ???
Hi JoshM,
I'd like to create a signal for semi-automatic trading where are plotted on a chart several different averages, and the trader can choose which media to use with a mouse click on the plot.
Much more intuitive and viewable and fast that every time not having to format the signal for changing the length of the average.
Regards
Massimo
I'd like to create a signal for semi-automatic trading where are plotted on a chart several different averages, and the trader can choose which media to use with a mouse click on the plot.
Much more intuitive and viewable and fast that every time not having to format the signal for changing the length of the average.
Regards
Massimo
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: PLOT_GetActive ???
If that signal does not perform auto-trading itself (but only generates the trading signals), you can for example also use mouse clicks with keyboard keys or mouse clicks locations on the chart.I'd like to create a signal for semi-automatic trading where are plotted on a chart several different averages, and the trader can choose which media to use with a mouse click on the plot.
Much more intuitive and viewable and fast that every time not having to format the signal for changing the length of the average.
For instance, a mouse click with Control held down could change the value of EMA 1, while a click with Shift changes the EMA 2, and EMA 3 is changed with a click + Control & Shift.
This can possibly be combined with a click in the top half of the chart (to increase the EMA value) or the bottom half (to decrease the EMA value). Or a click in the chart's left part to do something else compared to a click in the chart's right part.
I do think you need to use recalculate after changing an EMA length. That makes this not suitable for a strategy that submits orders itself, since those orders would be resubmitted (or open positions not closed) when the strategy is recalculated.
But if this really works depends on how many moving averages your strategy uses. If there are for example 10 different ones, it will become a lot harder to think of sensible mouse click and keyboard key combinations for that.
Or you can cycle through values. For example, a click with Control changes the EMA length to 20, the next click to 25, the click after that to 30, and so on, while for example a click with Shift resets the EMA length back to 20.
Re: PLOT_GetActive ???
Thank you for the links,
very clear and well explained.
Yes, this signal is for autotrading, so we can't use recalculate.
All of your suggestions would be good.
I opted for drawing text boxes with the different lengths, but obviously to click directly
on the plots would have been better.
Please, could you teach me how to find the first left bar number of the current chart ?
Regards
Massimo
very clear and well explained.
Yes, this signal is for autotrading, so we can't use recalculate.
All of your suggestions would be good.
I opted for drawing text boxes with the different lengths, but obviously to click directly
on the plots would have been better.
Please, could you teach me how to find the first left bar number of the current chart ?
Regards
Massimo
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: PLOT_GetActive ???
That's a little tricky since there is no keyword for that as far as I know.how to find the first left bar number of the current chart ?
But if you want to use this for aligning the text boxes you mentioned, you can draw a text box with Text_New_DT (or any other text keyword that accepts DateTime).
The time of the first bar to the left of the current bar is retrievable with `GetAppInfo(aiLeftDispDateTime)` (more on GetAppInfo), and that keyword returns a `DateTime` value that's usable with `Text_New_DT` and the other text keywords that accept `DateTime`.
Would this work? Otherwise we'd need to think of a workaround to achieve your goal.
Re: PLOT_GetActive ???
Perfect,
so now we have two new keywords to request to MC support&development:
PLOT_GetActive and GetAppInfo(aiLeftDispBarNumber).
Yes, I actually use
but I am not completely satisfied because the text box is not still in the same place but it moves, and sometimes at the change of the day date the box moves very much.
I have yet to figure out how to properly handle it.
Strange that with hundreds of keywords in PL sometimes lack the simplest things.
Regards
Massimo
so now we have two new keywords to request to MC support&development:
PLOT_GetActive and GetAppInfo(aiLeftDispBarNumber).
Yes, I actually use
Code: Select all
vValue1=Text_New_Dt(vX, vY1,"Text");
and
Text_SetLocation_DT(vValue1,vX,vY1);
where
vX = vMostLeftDateTime + vXOffset;
I have yet to figure out how to properly handle it.
Strange that with hundreds of keywords in PL sometimes lack the simplest things.
Regards
Massimo