Mike Medved Posted August 19, 2022 Report Share Posted August 19, 2022 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 callsSetInterVar(“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 intervar(‘EMA9’)-0.2 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. Quote Link to comment Share on other sites More sharing options...
Arg Posted August 23, 2022 Report Share Posted August 23, 2022 Is there a way to use this to have a hotkey sell when candle closes below an ema (a type of trailing stop)? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted August 27, 2022 Author Report Share Posted August 27, 2022 We do not let any orders initiate "automatically". For various reasons. But you can have a hotkey that sells *when you press it* if candle closed below an EMA. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.