reading candlestick parameters problem.

 
hi everyone
Im beginner and this is my first expert. this expert dont have error but "Alert" command not work.

please advice me.I want to read and compare parameters of candlestick's in my expert but I cant.

regards.



//+------------------------------------------------------------------+

//| myfirstprj.mq5 |

//| Copyright 2020, MetaQuotes Software Corp. |

//| https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2020, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

double open_val_bar1; // Variable to store the open value of a bar1

double open_val_bar3; // Variable to store the open value of a bar3

//+------------------------------------------------------------------+

//| Expert initialization function |

//+------------------------------------------------------------------+

int OnInit()

{

//---



//---

return(INIT_SUCCEEDED);

}

//+------------------------------------------------------------------+

//| Expert deinitialization function |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

{

//---



}

//+------------------------------------------------------------------+

//| Expert tick function |

//+------------------------------------------------------------------+

void OnTick()

{

MqlRates mrate[]; // To be used to store the prices, volumes and spread of each bar

ArraySetAsSeries(mrate,true); // the rates arrays

open_val_bar1=mrate[1].open; // bar 1 open price

open_val_bar3=mrate[3].open; // bar 3 open price

if(open_val_bar1 > open_val_bar3)

{

Alert ("price is increasing and last open price is :",open_val_bar1);

}

}
 
ramin Beygi:
hi everyone
Im beginner and this is my first expert. this expert dont have error but "Alert" command not work.

please advice me.I want to read and compare parameters of candlestick's in my expert but I cant.

regards.



You've forgotten CopyRates

Link

Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the rates_array array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically allocated...