Creating an Algo based on pattern/candlestick recognition

 

Hello guys, i have the following questions.


First of all i have no experience in coding, but i would like to know if its possible to create an algo, that recognizes Patterns just by the looks of the last 1-3 candles if you feed it enough samples what to look for. ( If so which programm is capable of doing that? )

Or do you have to calculate the values of those specific candles and put it into a code ? ( ** Which i would guess is not as precise as the pattern recognition option **, because the price movements in different situations will differ even if the pattern will look almost the same way, is that **  ** statement true? )


Also i would appreciate if someone could tell me the formula how to calculate the candlestick values to put into code which python understands, and if the following could work : i have different patterns which consists of 2-3 successively following candles, can you somehow put the

specifics of those patterns into a code/algo  that can recognize these patterns with accuracy as if the eye would see it in python ? ( or any other programm )



Thanks in advance. :D

 
yahyatrade: Hello guys, i have the following questions.First of all i have no experience in coding, but i would like to know if its possible to create an algo, that recognizes Patterns just by the looks of the last 1-3 candles if you feed it enough samples what to look for. ( If so which programm is capable of doing that? ) Or do you have to calculate the values of those specific candles and put it into a code ? ( ** Which i would guess is not as precise as the pattern recognition option **, because the price movements in different situations will differ even if the pattern will look almost the same way, is that **  ** statement true? ) Also i would appreciate if someone could tell me the formula how to calculate the candlestick values to put into code which python understands, and if the following could work : i have different patterns which consists of 2-3 successively following candles, can you somehow put the specifics of those patterns into a code/algo  that can recognize these patterns with accuracy as if the eye would see it in python ? ( or any other programm ) Thanks in advance. :D

Yes, there are such examples in MQL in the CodeBase and Articles. You should study them to get a better understanding of how they work.

However, given your lack of coding knowledge or experience, you are "biting off more than you can chew".

So, first start off by learning the "ABC" of coding, and start with very simple tasks, studying the examples in the CodeBase and reading up on Articles about how to write EAs in MQL.

 
Fernando Carreiro #:

Yes, there are such examples in MQL in the CodeBase and Articles. You should study them to get a better understanding of how they work.

However, given your lack of coding knowledge or experience, you are "biting off more than you can chew".

So, first start off by learning the "ABC" of coding, and start with very simple tasks, studying the examples in the CodeBase and reading up on Articles about how to write EAs in MQL.

Thank you for the answer , i know i have to catch up a lot in that field , thats why i was curious if there is some kind of programm where you only have to feed it with pictures for example which the programm will analyze and could then recognize those patterns by itself.

 
yahyatrade #:

Thank you for the answer , i know i have to catch up a lot in that field , thats why i was curious if there is some kind of programm where you only have to feed it with pictures for example which the programm will analyze and could then recognize those patterns by itself.

Even if there was a program which allowed the manual creation of sequences you would then have to check them individually . So such a program in a way would be meaningless to exist without the second component (which is what you want to do in python i guess) the selection of patterns .

There is a lot to unfold in this subject from how you group the patterns to how lenient you are with similarity to how the outcome is evaluated in the past and for how long etc.

I imagine your goal is to export "packages" of a pattern and then try and optimize it .If so for optimization you will need to export more than one patterns , in fact the best approach would be to export everything you come across with Y length , assuming Y is the # of candles in your pattern . So you'd export the pattern and it's outcome and then you'd do the optimization (or selection) in python (or excel , but in excel you'd be limited to one pattern at a time , then you'd have to remove it and run the solver again for the next one)

Here is an example that looks for pattern reoccurrence but not quite what you described . There was another with an input for the sequence but i forgot the name for now.  

Free download of the 'WmiFor 3.5 for MT5 (with DTW engine)' indicator by 'marketeer' for MetaTrader 5 in the MQL5 Code Base, 2019.12.23

WmiFor 3.5 for MT5 (with DTW engine)
WmiFor 3.5 for MT5 (with DTW engine)
  • www.mql5.com
This indicator predicts future price movements by searching for similar candle patterns in the rate history.
 
yahyatrade:

Hello guys, i have the following questions.


First of all i have no experience in coding, but i would like to know if its possible to create an algo, that recognizes Patterns just by the looks of the last 1-3 candles if you feed it enough samples what to look for. ( If so which programm is capable of doing that? )

Or do you have to calculate the values of those specific candles and put it into a code ? ( ** Which i would guess is not as precise as the pattern recognition option **, because the price movements in different situations will differ even if the pattern will look almost the same way, is that **  ** statement true? )


Also i would appreciate if someone could tell me the formula how to calculate the candlestick values to put into code which python understands, and if the following could work : i have different patterns which consists of 2-3 successively following candles, can you somehow put the

specifics of those patterns into a code/algo  that can recognize these patterns with accuracy as if the eye would see it in python ? ( or any other programm )



Thanks in advance. :D

Try googling "pattern recognition software for trading".

 
Lorentzos Roussos #:

Even if there was a program which allowed the manual creation of sequences you would then have to check them individually . So such a program in a way would be meaningless to exist without the second component (which is what you want to do in python i guess) the selection of patterns .

There is a lot to unfold in this subject from how you group the patterns to how lenient you are with similarity to how the outcome is evaluated in the past and for how long etc.

I imagine your goal is to export "packages" of a pattern and then try and optimize it .If so for optimization you will need to export more than one patterns , in fact the best approach would be to export everything you come across with Y length , assuming Y is the # of candles in your pattern . So you'd export the pattern and it's outcome and then you'd do the optimization (or selection) in python (or excel , but in excel you'd be limited to one pattern at a time , then you'd have to remove it and run the solver again for the next one)

Here is an example that looks for pattern reoccurrence but not quite what you described . There was another with an input for the sequence but i forgot the name for now.  

Free download of the 'WmiFor 3.5 for MT5 (with DTW engine)' indicator by 'marketeer' for MetaTrader 5 in the MQL5 Code Base, 2019.12.23

Appreciate your answer , actually i do not want to export or optimize anything, ill show you an example for what i mean.


Like in the picture , what i would need the algo to do is to recognize the pattern and open a position as soon as the candle marked as "2" closes, you can see its basically the same pattern in all of the 3 examples but the candles still have different characteristics.

So the question is if a python algo is acually codeable to that degree of recognizing those patterns even if they have different mathematical values, thats why im thinking a pattern recognition programm would be far superior here, also i have some trading ideas that consist of like

100-200 candles to form the entry signal , which even tho i have no knowledge about coding it seems almost impossible to be done with an programm like python. i guess D: :D


edit: because for example the body of "1" closes sometimes in the middle of the candle sometimes near the bottom, for "2" sometimes it has a wider body sometimes a small one which doesnt change the pattern in itself but their values , you see what i mean.


Maybe the H/L needs to be weighted more then the close of the body, but i guess i will have to learn coding to find out ..

Files:
bsp1.jpg  13 kb
bsp2.jpg  10 kb
 
Max Brown #:

Try googling "pattern recognition software for trading".

Its a rabbit hole if u dont know what ur looking for exactly , i have like 15 tabs open consisting of articles, videos and programms hhah.

 
yahyatrade #:

Appreciate your answer , actually i do not want to export or optimize anything, ill show you an example for what i mean.


Like in the picture , what i would need the algo to do is to recognize the pattern and open a position as soon as the candle marked as "2" closes, you can see its basically the same pattern in all of the 3 examples but the candles still have different characteristics.

So the question is if a python algo is acually codeable to that degree of recognizing those patterns even if they have different mathematical values, thats why im thinking a pattern recognition programm would be far superior here, also i have some trading ideas that consist of like

100-200 candles to form the entry signal , which even tho i have no knowledge about coding it seems almost impossible to be done with an programm like python. i guess D: :D


edit: because for example the body of "1" closes sometimes in the middle of the candle sometimes near the bottom, for "2" sometimes it has a wider body sometimes a small one which doesnt change the pattern in itself but their values , you see what i mean.


Maybe the H/L needs to be weighted more then the close of the body, but i guess i will have to learn coding to find out ..

Well its a candle pattern with a sequence of 2 . I assume you want python because whatever you want to trade is not in MT5 or because of the existing ML libraries ? 

You are going to face some of the mentioned issues anyway . 

But if we treat each 2 candles as a group,of candle A and candle B,  then it's features could be : 

  • ratio of the wicks to the body of A , of B and of A v B
  • ratio of the full size b2in the 2 candles
  • ratios of the price points

Then you could adjust which features matter and how lenient you are with deviations .

And you could test in excel too since you are looking for how "wide" this pattern could be .

The more specific the approach the less of an analyst you are (i'm joking) . 

edit : so you could actually do it this way here too . Have a program export all 2 bar groups from the pairs you are interested in along with some evaluation data and the group's features and then port it to your program of choice for optimization. (or even use MT5 in which case you would want to evaluate outside of a trading domain first , because you'd need to take all the signals as trades , so you'd use the custom criteria optimization in the built in mt5 tester)

 
yahyatrade #:

Its a rabbit hole if u dont know what ur looking for exactly , i have like 15 tabs open consisting of articles, videos and programms hhah.

Use Viktor Likhovidov's Candlecode.   

 
Lorentzos Roussos #:

Well its a candle pattern with a sequence of 2 . I assume you want python because whatever you want to trade is not in MT5 or because of the existing ML libraries ? 

You are going to face some of the mentioned issues anyway . 

But if we treat each 2 candles as a group,of candle A and candle B,  then it's features could be : 

  • ratio of the wicks to the body of A , of B and of A v B
  • ratio of the full size b2in the 2 candles
  • ratios of the price points

Then you could adjust which features matter and how lenient you are with deviations .

And you could test in excel too since you are looking for how "wide" this pattern could be .

The more specific the approach the less of an analyst you are (i'm joking) . 

edit : so you could actually do it this way here too . Have a program export all 2 bar groups from the pairs you are interested in along with some evaluation data and the group's features and then port it to your program of choice for optimization. (or even use MT5 in which case you would want to evaluate outside of a trading domain first , because you'd need to take all the signals as trades , so you'd use the custom criteria optimization in the built in mt5 tester)

Actually i thought python is the way to go because i assumed you have more options there since i have no clue wtf im doing ahahh.


I really appreciate you taking your time to answer to my questions, now i know it could be worth learning how to code and have some kind of direction.

 
Max Brown #:

Use Viktor Likhovidov's Candlecode.   

Thanks man! will look into it.

Reason: