Candle recognize questions - page 2

 
Jean Francois Le Bas:

ATR(140) for GBPUSD might be 0.00200

and for GBPJPY it might be 0.20000

ATR reflects the volatility of the pair, but also the relative size (price value) of the pair.

so it's a good indicator of the "size" of one candle

it adapts to the volatility as well as the value of the price


for example how do you know if a candle is "big" or not ? because the size means nothing.


well you can compare it with ATR AND the price itself

if you divide the ATR by the price, you got a normalized value that can be used to determine is a candle is "big" or not

for example:

"mul" is the min size you want.


hope it helps

Jeff

hi @Jean Francois Le Bas thankz for reaply  i try to understund  your teory , for mul i use a arbitrari number  like 68 , and not use high and low beacause i want a body of candel ,(for start)

for me not work i have 2 different number , i attach a screenshot of my  first test over XAUUSD and second  image is refer to USDCHF, you can look also you

Jean Francois Le Bas
Jean Francois Le Bas
  • www.mql5.com
Added topic My VPS crashes almost every day now My VPS crashes randomly and very often recently (almost every day) i looked in the log event viewer and i got these kind of errors "Activation context generation failed for "C:\Program Files (x86)\RSA MetaTrader 4 Terminal\terminal.exe".Error in Added topic How to get around max number...
Files:
atr2.jpg  228 kb
atr.jpg  185 kb
 

i tryed  also with ChartTimePriceToXY  but not  work for my problem

//+------------------------------------------------------------------+
//|                                                        trend.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  { 

   double CAndelA=SommaY(3);
   double CAndelB=SommaY(4) ;
   //Print("somma "+ Totalbody);
   Print("Candela A: "+ CAndelA);
 //  Print("Candela B: "+ CAndelB);
   int height=ChartGetInteger(0,CHART_SCALE,0);
   int width=ChartGetInteger(0,CHART_SCALE,0);
   Print("CHART_HEIGHT_IN_PIXELS =",height,"pixels");
   Print("CHART_WIDTH_IN_PIXELS =",width,"pixels");
 
  }


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double SommaY(int CandelNumb)
  {
   int      DOT_x,DOT_y;
   datetime DOT_B = iTime("USDCHF",PERIOD_H1,CandelNumb);
   bool ok = ChartTimePriceToXY(0,0,DOT_B,Open[CandelNumb],DOT_x,DOT_y);
   Print("OffLineChart: BarTime: ",DOT_B,
         "  x,y: ",DOT_x,", ",DOT_y,"   Error: ",_LastError,"  ok: ",ok);


   int DOT_x2,DOT_y2;
   datetime DOT_B2 = iTime("USDCHF",PERIOD_H1,CandelNumb);
   bool ok2 = ChartTimePriceToXY(0,0,DOT_B2,Close[CandelNumb],DOT_x2,DOT_y2);


   double Totalbody=(DOT_y+DOT_y2);
   return  Totalbody;

  }
// #INDEX# ========================================================================
// Title .........: Recognize candel type
// Language ......: English
// Description ...: return if is up candel or down candel or dogi
// Author ........: Faustf
// What do you do.: return if is up candel or down candel or dogi
// Version .......: 0.0.1 BETA - Work in progress 16/04/2020
// Syntax ........:
// ================================================================================

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int BodyCandelUPorDown(double DiffCAndelOpenClose)
  {

   if(DiffCAndelOpenClose>0.00000)   // long candel
     {
      // Print("up candel value: "+DiffCAndelOpenClose);
      return 1;

     }
   else
      if(DiffCAndelOpenClose == 0.00000)    //yagi candel
        {
         //Print("id dogi candel");
         return 0;
        }
      else
         if(DiffCAndelOpenClose <0.00000)    // short candel
           {
            // Print("down candel value: "+DiffCAndelOpenClose);
            return -1;

           }
  }
//+------------------------------------------------------------------+
it's very strange that MT not have a class for resolve this problem 
Reason: