# Does anyone know how to plot Support and resistance using a EA

I was wondering if there was a way the ea can plot support and resistance by itself and trade it base off of candlestick pattern. But mostly wanted to know about how to code a Ea that plots support and resistance.

There are functions in MQL4/MQL5 that can identify the highest or lowest price in a candle, and so you code it in a way that you can search the highs and lows in the last X candles - thus identifying your last support/resistance.

Look at this Youtube tutorial for an example

Javier Macias:
I was wondering if there was a way the ea can plot support and resistance by itself and trade it base off of candlestick pattern. But mostly wanted to know about how to code a Ea that plots support and resistance.
You can use zigzag indicator … add some condițions … conditions that one spike of the zigzag to be considered as suport/rezistance … or Find an indicator that plots these Lines on the chart… and use it in Your EA

There are functions in MQL4/MQL5 that can identify the highest or lowest price in a candle, and so you code it in a way that you can search the highs and lows in the last X candles - thus identifying your last support/resistance.

Look at this Youtube tutorial for an example

My logic in my code right now is this

Step1. Scan for 100 candlesstick or more from the past

Step2. Collect and store the date of all 100 to find out the high of each candlestick(Still dont know how i would do that,)

Step3. Go through all the candlestick high data and find the one that are near each other

Step4. Plot HLine

I got step one, Im having trouble understanding how i would store the values, probably most likely in a array(Just dont know how to store the data into array). Now the second problem im having is how would i code it where i would be able to find which candlestick high are close to each other in order to plot the HLine.

entrepreneur vision #:

My logic in my code right now is this

Step1. Scan for 100 candlesstick or more from the past

Step2. Collect and store the date of all 100 to find out the high of each candlestick(Still dont know how i would do that,)

Step3. Go through all the candlestick high data and find the one that are near each other

Step4. Plot HLine

I got step one, Im having trouble understanding how i would store the values, probably most likely in a array(Just dont know how to store the data into array). Now the second problem im having is how would i code it where i would be able to find which candlestick high are close to each other in order to plot the HLine.

Zigzag  indicator… find near peaks and draw a line..

While EA can plot any graphics , for this peculiar task an indicator would be appropriate. For instance it can draw a line between highs if the slope doesn't vary more than a given value.

Step1 << I am wondering how you scan this… >>
Step 2 << you don’t have to scan anything… you have build in functions for that iHigh, iLow… and so on
Step 3 << use a for loop
Step 4 << you don’t need to plot anything… you need to store that value and use it
You have indicators that already doing all the steps above … call them in your EA and use them…

entrepreneur vision:
I was wondering if there was a way the ea can plot support and resistance by itself and trade it base off of candlestick pattern. But mostly wanted to know about how to code a Ea that plots support and resistance.

1st: (if you already know how to plot objects onto the chart).

Use:

iHighest for resistance levels. (function returns the highest candle out of a specified amount of bars)

iLowest for support levels. (function returns the lowest candle out of a specified amount of bars)

2nd:(if you don't posses the knowledge on how to plot objects onto the chart)

Use:

This page from Mql4 Book on "Graphical Objects"  because it teaches you how to plot objects onto the "sub-window" or "main-chart".

However, in order to properly know-how to plot objects, you must already possess clear knowledge on how arrays work. Refer to this pages from Mql4 book: (Arrays)

and mql4 documentation (Array Functions).

Important: As a New Coder, I've come to realize that trying to learn how to code by copying others code, requesting code, or simply seeking out answers from the Forum, is not

a rewarding approach to learning coding. In contrary, I've learned tons of accurate coding information from simply reading the Mql4 documentation and Mql4 book respectively.

These sources are extremely valuable in teaching one how to be self-reliant, but in the instant any concept found within these referenced, appear unclear or vague, this is when I feel clarity should be sought from others in the forum who possess deeper insight.

(In my opinion). Best regards.

iHighest - Timeseries and Indicators Access - MQL4 Reference
• docs.mql4.com
iHighest - Timeseries and Indicators Access - MQL4 Reference

30-Dimensions #:

1st: (if you already know how to plot objects onto the chart).

Use:

iHighest for resistance levels. (function returns the highest candle out of a specified amount of bars)

iLowest for support levels. (function returns the lowest candle out of a specified amount of bars)

2nd:(if you don't posses the knowledge on how to plot objects onto the chart)

Use:

This page from Mql4 Book on "Graphical Objects"  because it teaches you how to plot objects onto the "sub-window" or "main-chart".

However, in order to properly know-how to plot objects, you must already possess clear knowledge on how arrays work. Refer to this pages from Mql4 book: (Arrays)

and mql4 documentation (Array Functions).

Important: As a New Coder, I've come to realize that trying to learn how to code by copying others code, requesting code, or simply seeking out answers from the Forum, is not

a rewarding approach to learning coding. In contrary, I've learned tons of accurate coding information from simply reading the Mql4 documentation and Mql4 book respectively.

These sources are extremely valuable in teaching one how to be self-reliant, but in the instant any concept found within these referenced, appear unclear or vague, this is when I feel clarity should be sought from others in the forum who possess deeper insight.

(In my opinion). Best regards.

I think that before  being a little coder, you need to be a little trader… the highest candle from a bunch o candles doesn’t necessarily make it a support / resistance … you need a little more…
Reason: