High[x] returns the high price of the period at shift x. https://docs.mql4.com/predefined/high iHighest() returns the shift of where the highest price is observed for the defined periods. https://docs.mql4.com/series/ihighest Combine them to obtain the highest price for the defined periods: double highestPrice = High[iHighest(Symbol(), 0, MODE_HIGH, 10, 1)]; In this example, the last parameter being “1” … Continue reading
To obtain a period’s open time, we can use either CopyTime() https://www.mql5.com/en/docs/series/copytime or SymbolInfoInteger() https://www.mql5.com/en/docs/marketinformation/symbolinfointeger I’ve attached a script testing the speed of each showing that SymbolInfoInteger() is faster than CopyTime() by 50%, even after optimisation. Just throwing it out there.
‘Selecting’ a Position “copies data about a position into the program environment, and further calls of PositionGetDouble(), PositionGetInteger() and PositionGetString() return the earlier copied data. This means that the position itself may no longer exist (or its volume, direction, etc. has changed), but data of this position still can be obtained. To ensure receipt of … Continue reading
Posting this as a repository for myself as I can’t remember what I wrote yesterday much less a few months ago. This script illustrates 2 things: 1. Getting indicator values in MQL5 is more laborious than in MQL4 if you only need 1 value 2. Calling a default indicator function versus iCustom() Know that iMACD() … Continue reading
Getting a price at a Fibonnaci percentage level is a straightforward mathematical calculation. We just need to define 3 things: 1. Price at 100% 2. Price at 0% 3. Percentage to return Price at This is a script illustrating all the calculation needed: You just need these 2 lines to to obtain your required price … Continue reading