Forex Zone | Forex Forum

Indi Coding

Discussion started on MT4 / MT5 Indicators

  • Posts: 352
  • Points: 71
  • Likes Received: 144
  • Reputation: +11/-0
Indi Coding in MT4 / MT5 Indicators_xx
Hi all
I started learning MQL, so hopefully one of these weeks (years :-[) I can help with coding here.
As I am still in the beginning of tutorials, I can only do very basic stuff, like the "Hello world" to appear on a chart or calling an alert etc.
What I want to ask any coder please, 
How do I get the highest close of x amount of candles, and the draw (paint) that line on a chart.
Same with the lowest close of c amount of candles. 
I tried Close(120) but it obviously only give me candle # 120's close (And not even a dot on the chart :o)
Thanks for the help

#1 - August 23, 2018, 01:35:13 PM

  • Indi Coding in MT4 / MT5 Indicators_index
  • Posts: 3309
  • Points: 34303
  • Likes Received: 2996
  • Reputation: +170/-13
Indi Coding in MT4 / MT5 Indicators_xx
You don't want to use just the Close[] array since that will just give you the close of x shift. What you need to do is use iHighest() with Close[].

So to find the highest close price of the last 120 candles, it would look something like this:

Code: [Select]

Drawing a horizontal line after you get this is simple. You can use the ObjectCreate() function.
#2 - August 23, 2018, 03:07:17 PM

  • Posts: 352
  • Points: 71
  • Likes Received: 144
  • Reputation: +11/-0
Indi Coding in MT4 / MT5 Indicators_xx
No wonder it only returned 1 value
#3 - August 23, 2018, 04:44:17 PM


0 Members and 1 Guest are viewing this topic.

* Share Topic

Share via delicious Share via digg Share via facebook Share via linkedin Share via pinterest Share via reddit Share via stumble Share via tumblr Share via twitter

* Similar Topics

EATA Crossover Indi NEW

Started by Claywalker on Indicator Modifications

14 Replies
Last post February 18, 2019, 08:11:16 PM
by Mulyana
want this indi MTF, colour change on slope and interpolated

Started by alpha24 on Indicator Modifications

9 Replies
Last post February 18, 2019, 11:18:48 PM
by paidto
EATA Pollan Indi Mods Needed

Started by Fastmonty on Indicator Modifications

10 Replies
Last post July 18, 2019, 06:54:20 AM
by rali
hi please help me to put push notification in this indicator.. (mega-trend-indi)

Started by Quash on Indicator Modifications

1 Replies
Last post May 26, 2020, 11:08:26 PM
by LazyProg