measuring the position of the candles

 
How can I check if the current candle is higher (position) than the previous one, I mean only the two current ones?
Files:
swieczki.PNG  23 kb
 
virusek391:
How can I check if the current candle is higher (position) than the previous one, I mean only the two current ones?

Code:

//+------------------------------------------------------------------+
//|                                                            1.mq5 |
//|                              Copyright © 2020, Vladimir Karputov |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2020, Vladimir Karputov"
#property version   "1.000"
//---
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   return (INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   int start_pos=0,count=3;
   if(CopyRates(Symbol(),Period(),start_pos,count,rates)!=count)
      return;
//---
   if(rates[0].high>rates[1].high)
     {
      //--- the 'High' price of bar # 0 is higher than the High price of bar # 1
     }
//---
  }
//+------------------------------------------------------------------+
Files:
1.mq5  4 kb
 
Vladimir Karputov:

Code:

Ok, and tell me how to check when the first dot appears on the SAR indicator?


Vladimir Karputov:

Code:

Files:
pic.PNG  50 kb
 
virusek391:

Ok, and tell me how to check when the first dot appears on the SAR indicator?


Example: how to get the value of the iSAR indicator in an advisor. 
How to start with MQL5
How to start with MQL5
  • 2020.08.26
  • www.mql5.com
This thread discusses MQL5 code examples. There will be examples of how to get data from indicators, how to program advisors...
 

Ok thank you for fast answer :)

hm and how can i protect my code in MQL5 beforing copy? ( hide source code)

 
virusek391 :

Ok thank you for fast answer :)

hm and how can i protect my code in MQL5 beforing copy? ( hide source code)

My advice: you have nothing to hide - you are still young and green :)

 
Vladimir Karputov:

My advice: you have nothing to hide - you are still young and green :)

Yes,  I am a beginner :)
 
Vladimir Karputov:

Code:


And how can i detect only new spike bars and how can i measuring the position of the spike candles only?
Files:
bar.PNG  9 kb
 
virusek391 :

And how can i detect only new spike bars and how can i measuring the position of the spike candles only?

I do not understand. Don't use slang expressions.

 
Vladimir Karputov:

I do not understand. Don't use slang expressions.

Ok :)

How detect only this white bars and then 

measuring the position of last two white bars only:)
Files:
swieca2.PNG  22 kb
 
virusek391 :

Ok :)

How detect only this white bars and then 

measuring the position of last two white bars only:)

Work with MqlRates   structure and compare the Open price and Close price.

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / History Data Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / History Data Structure
  • www.mql5.com
History Data Structure - Data Structures - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5