Support And Resistance Identification System Using MQL5
Published: 2023-09-25 10:37:46

## Identify Support and Resistance Using Significant High and Low Levels

The Support and Resistance Identification System is used to identify levels of significance using significant high and low levels.

A level of significance is a level in price that can be used to enter or exit positions, or set position stops.

A significant high and low level is identified using the highest and lowest prices within price ranges.


![Support and Resistance Identification System](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5xl8vdh13yt2lnj8cov.png)


## Project Description

Significant highs and lows ae identified using price ranges.
Price ranges are identified using start indexes and end indexes to identify the highest and lowest price between those indexes.

We will be using a total of 100 candles for our identification.
The total values can be changed to suite the needs of the strategy.


## Program Description

Resistance levels will be drawn based on high levels and will be drawn Blue.

Support levels will be drawn based on low levels and will be drawn Red.


##Code Description

At the top of our file we will include the following code.

```

#include <IncludeHighLowData/HighLowData.mqh>

#include <IncludeLineObjects/LineSystems.mqh>

HLowHigh MyHighLowData;

```

`#include` is used to get the necessary data classes for our high and low identification, and drawing line types.

`HLowHigh MyHighLowData` we define a high and low data object, this object will be used to get high and low values.

`HLowHigh` is a class with the necessary methods for our system.
`MyHighLowData` is an object used to access the class methods.


Within the `OnTick` function we will add the following code.

```
void OnTick(){
    MyHighLowData.Add_Array_Data();
}

```

The `Add_Array_Data` method is based on the `CopyBuffer` function.
This method is used to add the array data to the `MyHighLowData` object.
Without this method we cannot access current data.


```

double highest_100 = MyHighLowData.High_Value(50,100);

double highest_50 = MyHighLowData.High_Value(20,50);

double highest_20 = MyHighLowData.High_Value(5,20);

```

Using the `High_Value(start, end)` method we access the most significant high between the start and end index.

The `highest_100` variable stores the high value of the most significant high between the 50 and 100 index.

The `highest_50` variable stores the high value of the most significant high between the 20 and 50 index.

The `highest_20` variable stores the high value of the most significant high between the 5 and 20 index.

```
double lowest_100 = MyHighLowData.Low_Value(50,100);

double lowest_50 = MyHighLowData.Low_Value(20,50);

double lowest_20 = MyHighLowData.Low_Value(5,20);

```

Using the `Low_Value(start,end)` method we acess the most significant low between the start and end index.

The `lowest_100` variable stores the low values of the most significant low between the 50 and 100 index.

The `lowest_50` variable stores the low value of the most significant low between the 20 and 50 index.

The `lowest_20` variable stores the low value of the most significant low between the 5 and 20 index.

```

Create_Horizontal_Line("Highest 100", highest_100, clrBlue);
Create_Horizontal_Line("Highest 0", highest_50, clrBlue);
Create_Horizontal_Line("Highest 20", highest_20, clrBlue);

Create_Horizontal_Line("Lowest 100", lowest_100, clrRed);
Create_Horizontal_Line("Lowest 50", lowest_50, clrRed);
Create_Horizontal_Line("Lowest 20", lowest_20, clrRed);

```

The `Create_Hprizontal_Line` function will draw a horizontal line at a significant high and low price.

High levels will be identified using a Blue horizontal line.

Low levels will be identified using a Red horizontal line.


![Support And Resistance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81mxa5hi4re3rao4x17e.png)


Access to the full code:
{% embed https://github.com/HloniTheCoder/Support-And-Resistance-Data %}