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
Francois
 

Linkback: https://www.forex.zone/mt4-mt5-indicators/8/indi-coding/196/
#1 - August 23, 2018, 01:35:13 PM

  • Indi Coding in MT4 / MT5 Indicators_index
  • Posts: 3000
  • Points: 33272
  • Likes Received: 2822
  • Reputation: +156/-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]
Close[iHighest(NULL,0,MODE_CLOSE,120,0)]

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
Thanks.
No wonder it only returned 1 value
;D
#3 - August 23, 2018, 04:44:17 PM

Members:

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

clip
EATA Crossover Indi NEW

Started by Claywalker on Indicator Modifications

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

Started by alpha24 on Indicator Modifications

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

Started by Fastmonty on Indicator Modifications

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

Started by Quash on Indicator Modifications

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