Script to Draw Middle Line of a Channel

Enivid

Administrator
Staff member
Nov 30, 2008
19,403
1,566
144
Odesa
www.earnforex.com
A while ago, a user on Reddit asked about a MetaTrader script to automatically draw a middle line for a channel chart object. Now, after wishing to have such a script myself a few times, I decided to finally code it both for MT4 and MT5.

The script's source code and the compiled files are attached to this post and are available for free download.

You can simply run the script on a chart with a channel object named Channel (or anything else, but make sure to change the respective input parameter), and it will calculate the exact points and will create a middle line that bisects the channel.

Bug reports and suggestions are welcome!
 

Attachments

  • ChannelMiddleLine.ex4
    11.6 KB · Views: 13
  • ChannelMiddleLine.mq4
    4.7 KB · Views: 30
  • ChannelMiddleLine.ex5
    18.2 KB · Views: 15
  • ChannelMiddleLine.mq5
    3.7 KB · Views: 23

Saesint2

Newbie
Feb 5, 2023
1
0
1
34
A while ago, a user on Reddit asked about a MetaTrader script to automatically draw a middle line for a channel chart object. Now, after wishing to have such a script myself a few times, I decided to finally code it both for MT4 and MT5.

The script's source code and the compiled files are attached to this post and are available for free download.

You can simply run the script on a chart with a channel object named Channel (or anything else, but make sure to change the respective input parameter), and it will calculate the exact points and will create a middle line that bisects the channel.

Bug reports and suggestions are welcome!
Pls how do I see trend state script results
 

omidghb

Trader
Sep 21, 2024
3
0
6
32
Thanks for providing the scrips. I downloaded and installed the scripts. but nothing happens when I run it. Do you have any idea what is wrong with that?
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,403
1,566
144
Odesa
www.earnforex.com
Thanks for providing the scrips. I downloaded and installed the scripts. but nothing happens when I run it. Do you have any idea what is wrong with that?
Do you have an equidistant channel object added to your chart? If so, are you entering its name in the script's input parameters correctly?
 

omidghb

Trader
Sep 21, 2024
3
0
6
32
Do you have an equidistant channel object added to your chart? If so, are you entering its name in the script's input parameters correctly?
Yes, I do have an equidistant channel on the chart. No, I did not change anything. Can you elaborate more on the second part of your answer? I am not good at programming stuff. I would really appreciate it if you would help me with that.
 

Enivid

Administrator
Staff member
Nov 30, 2008
19,403
1,566
144
Odesa
www.earnforex.com
Yes, I do have an equidistant channel on the chart. No, I did not change anything. Can you elaborate more on the second part of your answer? I am not good at programming stuff. I would really appreciate it if you would help me with that.
There is nothing to program. The script has to find your channel somehow - so you either enter the channel's name in the script's input parameter or you name the channel 'Channel', which is the default value used by the script. You can also see a small video tutorial in the second post of this thread.