Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Highest Gain - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 5 reads | 0 comments |

Highest High Get - Script.

1 file - Size: 1.62 KB.

The code defines a function "RangeHighs" which accepts 4 integer inputs: pStartHour, pStartMins, pEndHour and pEndMins, which represent the start and end times of a period.

It first initializes the "MqlDateTime" structure "time" and uses the "TimeCurrent" function to get the current time. It then sets the seconds and hours/minutes values ​​of "time" as input parameters.

Then use the "StructToTime" function to convert the "time" structure to the "datetime" type and store it in the "timeStart" and "timeEnd" variables. These variables represent the start and end times of the time period of interest.

The code then declares an array "high" and sets it to a series using the "ArraySetAsSeries" function. Then use the "CopyHigh" function to copy the highest price of the trading symbol within the specified time period to the "high" array.

Finally, the function returns the highest value in the "high" array, which is found using the "ArrayMaximum" function.

The "RangeHighs" function can be used in MetaTrader 5 Expert Advisor to calculate the highest price of a financial instrument within a specified time range and use it for trading logic, such as entry or exit conditions.


Attachment download

📎 high_fetch.mq5 (1.63 KB)

Source: MQL5 #42653

Verification code Refresh