How to find two candlesticks from two different timeframes with same high and open (upper wick) - page 2

 
I don't see any idea in this. Also I don't see a nice way to SHOW the match found. Therefore, I leave the discussion.
 
As I was thinking about what you are trying to achieve and being inspired by the screenshots of Vladimir, I would go following to solve this.

No matter the usage.

You are trying to do a top down search, while I would do a bottom up search.

Starting at M1, using the highest time-frames granularity, here M20 as the data selection point for the dataset of M1 periods.

As I have the M1 rates from ie 6:20 to 6:39 (20 periods) I'd utilize candle math to form the higher periods candles.

From here you could go different paths, depending on your needs.

Either search the rates from copy rates to see if you find the candle you have synthesized yourself. (This is especially to verify your own results)

Or assume you are doing it correctly and therefore you already have your results. Because they are the source you created the result from.

I hope you understand which approach I mean.

Displaying them is of course another issue, but that could be done with text labels on the M20 chart at the period of concern.

Or another way of displaying would be on lower time-frames by drawing rectangles and wicks. (Using trend lines)

This would give you some visualization.

When trying to do this in an indicator, you need to take extra measures to make the terminal load the other timeframe rates. I suggest loading iATR for the time frames in question to make the terminal load the data.

Inside an ea, you should use a different approach to load the data. Search the codebase for "history loader".

Greetings.
 
Vladimir Karputov:
I don't see any idea in this. Also I don't see a nice way to SHOW the match found. Therefore, I leave the discussion.

The idea is still being developed and manually searching through timeframes for the match makes it extremely difficult to find. That's why I'm working on this. With this I'll be able to quickly test  refine the idea and make the necessary changes. 

As I said in an earlier comment, there is definitely no elegant way to draw the match on the chart but using a rectangle should do. As this is still work in progress, it is likely that the way to display the final result would follow naturally.

I have been learning MQL5, and I want to use this also as an opportunity to learn more as I work on a strategy. Generally, searching through an array of lower  timeframes for a match has been an issue for me. I believe the solution to this would help anyone on the forum having similar issues. 

 
Dominik Egert:
As I was thinking about what you are trying to achieve and being inspired by the screenshots of Vladimir, I would go following to solve this.

No matter the usage.

You are trying to do a top down search, while I would do a bottom up search.

Starting at M1, using the highest time-frames granularity, here M20 as the data selection point for the dataset of M1 periods.

As I have the M1 rates from ie 6:20 to 6:39 (20 periods) I'd utilize candle math to form the higher periods candles.

From here you could go different paths, depending on your needs.

Either search the rates from copy rates to see if you find the candle you have synthesized yourself. (This is especially to verify your own results)

Or assume you are doing it correctly and therefore you already have your results. Because they are the source you created the result from.

I hope you understand which approach I mean.

Displaying them is of course another issue, but that could be done with text labels on the M20 chart at the period of concern.

Or another way of displaying would be on lower time-frames by drawing rectangles and wicks. (Using trend lines)

This would give you some visualization.

When trying to do this in an indicator, you need to take extra measures to make the terminal load the other timeframe rates. I suggest loading iATR for the time frames in question to make the terminal load the data.

Inside an ea, you should use a different approach to load the data. Search the codebase for "history loader".

Greetings.


I don't fully understand how I would piece the M1 candles together to get the highs and opens of higher timeframe candles. May I please ask for an example on this?

 
Gillorone:


I don't fully understand how I would piece the M1 candles together to get the highs and opens of higher timeframe candles. May I please ask for an example on this?

Easy. 

M20 is composed from the following infos: OHLC

When adding 20 M1 candles to one M20 candle, you take the open of the first M1 and use it as Open for M20.

Then you search the set of M1 candles for the lowest low. This is your M20 low.

You do the same for high.

 The close value oof the last M1 candle from this series is your close of the M20 candle.


This can be done to achieve any higher timeframe.

M11, M14.... whatever you take as your set of M1 candles.


Got it?

 
Gillorone: I don't fully understand how I would piece the M1 candles together to get the highs and opens of higher timeframe candles. May I please ask for an example on this?
  1. Get the time of the HTF start. Use iBarShift to get the index of the M1 start. Same open price.
  2. Get the time of the HTF end (start + PeriodSeconds(PERIOD_HTF) - 1). Get the index of the M1 end. Find the index of the highest high between M1 start and M1 end inclusive. Same high price.
  3. Gillorone: I haven't been able to get this working. Can I please get some help.

    “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
         How To Ask Questions The Smart Way. 2004
              When asking about code

    Help you with what? You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help 2017.04.21