Jump to content
Medved Trader Forums

Just an FYI about paintbars and hotkeys interaction

Recommended Posts

There is a mechanism of interaction between hotkeys and charts that will allow you to use any indicator or in general any computed value from the chart in a hotkey.


That’s the ChartVar and InterVar (look it up in the MT help file)

The flow is as follows:

1. You make a paintbar that sets an InterVar or a ChartVar (with a SetInterVar or a SetChartVar function in the paintbar). (Or you can even do the SetInterVar inside a scan).

2. You place that paintbar on the chart from which you will be executing the hotkey (or if it is in a scan, run the scan)

3. Inside the hotkey, you can reference that InterVar or ChartVar by calling the intervar or chartvar in the hotkey for the particular parameter (like the limit price).

So – for EMA(9) for example, you would have a paintbar that uses EMA(9), calls it let’s say EMA9 inside its code, then calls

SetInterVar(“EMA9”, EMA9);   // this will set the intervar “EMA9” for this symbol, to be used in the hotkey


Inside the hotkey, in the Limit parameter for example, you would use




or something like that. That way the value that is set in the paintbar would be passed to the hotkey.

Of course, the value that is passed can be a result of some complex calculation in the paintbar, not necessarily just an indicator value.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...