Candlestick analysis. Pattern coding - page 3

 
Alexey:
if(Open[j]<Close[j])//Черная свеча
  {
  if(High[j]==Close[j]&&Open[j]==Low[j]) //Черный бар без хвостов
  if(High[j]>Close[j]&&Open[j]>Low[j])   //Черный бар хвост верх и вниз
  if(High[j]>Close[j]&&Open[j]==Low[j])  //Черный бар хвост в верх
  if(High[j]==Close[j]&&Open[j]>Low[j])  //Черный бар хвост вниз
  }
//----------
if(Open[j]>Close[j])//Белая свеча
  {
  if(High[j]==Open[j]&&Close[j]==Low[j])  //Белый бар без хвостов
  if(High[j]>Open[j]&&Close[j]>Low[j])    //Белый бар хвост верх и вниз
  if(High[j]>Open[j]&&Close[j]==Low[j])   //Белый бар хвост в верх
  if(High[j]==Open[j]&&Close[j]>Low[j])   //Белый бар хвост вниз
  }
//----------
if(Open[j]==Close[j])//Нет свечи
  {
  if(High[j]>Open[j]&&Close[j]>Low[j])     //+
  if(High[j]==Open[j]&&Close[j]==Low[j])   //-
  if(High[j]==Open[j]&&Close[j]>Low[j])    //хвост в низ
  if(High[j]>Open[j]&&Close[j]==Low[j])    //хвост в верх
  }

Decode the bar, add your condition to the right line and get what you want.

By the way, this is one example where if is not replaceable and there are quite a few

Second line think carefully

 if(High[j]==Close[j]&&Open[j]==Low[j]) //Черный бар без хвостов
 
IgorM:
I ask the audience with a question on how to code, well, let it be my question on the development of the alphabet for candlestick combinations: comb_A, comb_B, comb_C, comb_D, comb_E - respectively Fig. 1-5.
Do you limit the number of candles in a particular combination, or can there be 2 or 3, or 4, or 5?
 
VOLDEMAR:

Second line think carefully

everything's right here.
 
Alexey:
if(Open[j]<Close[j])//Черная свеча
  {
  if(High[j]==Close[j]&&Open[j]==Low[j]) //Черный бар без хвостов
  if(High[j]>Close[j]&&Open[j]>Low[j])   //Черный бар хвост верх и вниз
  if(High[j]>Close[j]&&Open[j]==Low[j])  //Черный бар хвост в верх
  if(High[j]==Close[j]&&Open[j]>Low[j])  //Черный бар хвост вниз
  }
//----------
if(Open[j]>Close[j])//Белая свеча
  {
  if(High[j]==Open[j]&&Close[j]==Low[j])  //Белый бар без хвостов
  if(High[j]>Open[j]&&Close[j]>Low[j])    //Белый бар хвост верх и вниз
  if(High[j]>Open[j]&&Close[j]==Low[j])   //Белый бар хвост в верх
  if(High[j]==Open[j]&&Close[j]>Low[j])   //Белый бар хвост вниз
  }
//----------
if(Open[j]==Close[j])//Нет свечи
  {
  if(High[j]>Open[j]&&Close[j]>Low[j])     //+
  if(High[j]==Open[j]&&Close[j]==Low[j])   //-
  if(High[j]==Open[j]&&Close[j]>Low[j])    //хвост в низ
  if(High[j]>Open[j]&&Close[j]==Low[j])    //хвост в верх
  }

Decode the bar, add your condition to the right line and get what you want.

By the way, this is one example where if is not replaceable and there are quite a few

Compare real numbers?????
 
svds75:
Do you limit the number of candles to a certain combination somehow, or can there be 2 as well as 3, or 4, or 5?

Let's look at a concrete example with pictures for now, as Integer wrote : " First, you just have to code, then, increase efficiency. "

i.e. there are only 5 pictures and you need a methodology for that, well roughly how:

enum alphabet{A,B,C,D,E};
struct OHLC{
   double open;
   double high;
   double low;
   double close;
};
//___________________________________________________________________
alphabet DecodeBar(const OHLC &bar1,const OHLC &bar2){
// эффективный код
return(A);
}
//___________________________________________________________________
alphabet DecodeBar(const OHLC &bar1,const OHLC &bar2,const OHLC &bar3){
// эффективный код
return(B);
}
 
IgorM:
it is all clear, and any "average programmer" can implement it, I am asking the audience with a question how to code, well, let it be my question to develop the alphabet for candlestick combinations: comb_A, comb_B, comb_C, comb_D, comb_E - respectively fig. №№ 1-5
What you propose would not be a problem for a mid-level programmer either. Especially when half the work is already done
 

Er, colleagues, create your own thread for candle combinations, who's stopping you? :-)

This is, like, a different thread...

I'd like to get involved myself... There is a ground for applying combinatorics there...

 
IgorM:
This is all understandable, and any "average programmer" can implement it, I ask the audience with a question how to code, well, let it be my question to develop the alphabet for candlestick combinations: comb_A, comb_B, comb_C, comb_D, comb_E - respectively Figures 1-5
And you do not need to code, and break candles into combinations, and for this you first need to learn to distinguish them, my example just describes these differences
 
Alexey: my example exactly describes these differences
Yes it does, but sorry - the problem is solved head-on, it's not the best option to change the ifs every time
 
Vinin:
Compare real numbers?????
This is code from a working skipet, on calculating the volumes of candles of different types.
Reason: