I am trying to get the highest and lowest value of a certain number of bars starting from the bar which is already closed. Can anybody help?

4 Views
Willis Holt
Answered 9 months, 1 week ago
<p id="isPasted">We are all watching the same market, but one trader uses a 5 minute bar, one uses a 1 minute bar, another a 30 minute bar, another a 10K vol bar, another a 5K tick bar, another an 8 range bar, and so on. These are just data presentation mechanisms, and the market does not have a concept of any of them; they are purely our creation. The close of a bar is a snapshot of a price traded in the flow of market activity.</p><p>&nbsp;What are your thoughts? If you use the closing of a bar as a part …</p>
3 Views
Jan Morales
Answered 2 weeks, 2 days ago
<p id="isPasted">In MQL4 and MQL5 (MetaTrader platforms), you can find the highest and lowest values of a specific range of bars by using functions that return the index of the extreme value, then retrieving the actual price from that index.&nbsp;</p><p>To start from the first "already closed" bar, you should use an offset of 1, as index 0 always represents the current live candle.&nbsp;</p><p><strong>For MQL4</strong></p><p>Use iHighest() and iLowest() to find the index, then High[] or Low[] to get the value.</p><p><strong>Logic:</strong></p><p>int highestIndex = iHighest(NULL, 0, MODE_HIGH, N, 1); (N = number of bars to check)</p><p>double highestValue = …</p>
1 View