graphically display current trend for all time frames in one simple panel
Info
The graphically display current trend for all time frames in one simple panel is a Indicator for MetaTrader 4 that this is a graphical indicator based on slope-direction-trend indicator that has been published under several other forms. one can search to see multiple results.
Usage
This tool is typically used for trend following strategies across multiple currency pairs.
Platform
This Indicator works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Indicators folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use graphically display current trend for all time frames in one simple panel
1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.
2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.
3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.
4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.
Frequently Asked Questions
Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."
Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).
Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.
What this tool does
this is a graphical indicator based on slope-direction-trend indicator that has been published under several other forms.
Typical Use Case
This Indicator excels in trend following on MetaTrader 4.
Compatible Platform & Setup
This Indicator works on MetaTrader 4. Place the file in the MQL4/Indicators folder and restart the terminal.
Description & Settings
Related: Moving Averages Displayed on Chart Periphery - another powerful indicator for MetaTrader 4 traders.
this is a graphical indicator based on slope-direction-trend indicator that has been published under several other forms.
Also recommended: Display Ask-Bid - similar indicator with strong performance on MetaTrader 4.
one can search to see multiple results.i have taken this indicator and made it into a graphical panel displaying all time frames and made a few slight modifications to the original code. one of them is that it allows the user to select the second moving average method used for smoothing. the original code used linear weighted for its second pass on the numbers whereas i give the user the option to choose the method for smoothing. when using linear weighted for both calculations, it makes the indicator too responsive and thus possibly giving false readings on the current trend. if we use simple as the second averaging method we get a trend that is more indicative of where the price is going.
another change that i have made is the ability to not only get the direction of the trend (up, down or flat) but also get its value. i will talk about this in another article i plan on publishing shortly on how to use a double slopedirection indicator and create a expert advisor with it.
but for now, let's take a quick look at the code. i first define all the object names i will use. the reason why this is good practice to do is that each time you put an object name between quotes, it allocates space in the program for it. so it they are defined once (by using a define statement) you only use up the space in your code once.
next, i define two arrays. one with the pixel position for each of the 9 time frames and the second with the time frames. these are defined as global variables.
our indicator oninit() function calls a function to create the panel and the objects within the panel. it also does a quick "dumn dumn" check on the bars used to calculate the trend. less than 3 is kind of pointless.
i will not get into details on how the gettrend() function really works, there's already good documentation on this site for that. we'll just take a look at the graphical displaytrend() function.
basically, we simply loop thru the trendperiods[] array (to get all time frames) and set the trend arrow according to that time frame's trend direction. if the trend is flat, we find the first direction that is not flat to know where the trend was coming from in order to display the side arrow in the color of that direction.
the create_panel() function in our oninit() creates the objects anchored to the bottom left of the screens and uses trendposition[] to place the arrows in the right place.
this function will return true if it succeeded in creating all the objects, or return false if an error occurred creating an object. the nice thing is that the indicator will display in the expert tab of your console the error code and the line number of the code where the error occurred.
we also need to update the trend indicator for each new tick we receive. this is done by calling displaytrend() in our start() function.
lastly, we destroy all objects created by the indicator when we close the indicator.
that's basically it. you now have a nice indicator panel showing the current trend for all time frames in the lower left of your screen.
enjoy!
You may also like: MT4/MT5 Tick Chart Recording and Display - excellent alternative for indicator users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#property link "https://robotfx.org"
#property version "1.00"
#property strict
#property indicator_chart_window
extern int barcount = 9;
extern enum_ma_method method = mode_sma;
#define uptrend 1
#define downtrend -1
#define flattrend 0
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.