Script having problem with Candles array
Show your code illustrating problem
This is a script not indicator, not EA.
int start() {
int spike;
while (true) {
RefreshRates();
spike = NormalizeDouble( (Bid - iClose(Symbol(),PERIOD_M1,1)) / Point, 0);
if (spike > SpikeDanger) {
Comment("Danger!");
PlaySound("alert.wav");
}
Sleep(100);
}
return(0);
}
When I run it, it wont give me a new iClose value...
I checked it, and it works properly !
//+------------------------------------------------------------------+
//| CheckiClose.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.ru/"
int SpikeDanger=5;
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int spike;
while (true) {
RefreshRates();
spike = NormalizeDouble( (Bid - iClose(Symbol(),PERIOD_M1,1)) / Point, 0);
Comment("Bid=",Bid," iClose(Symbol(),PERIOD_M1,1)=",iClose(Symbol(),PERIOD_M1,1) );
if (spike > SpikeDanger) {
Alert(Symbol()+"- Danger!");
PlaySound("alert.wav");
}
Sleep(300);
}
//----
return(0);
}
//+------------------------------------------------------------------+
It appears however, that this array remains constant.
ie:
iClose(Symbol(),PERIOD_M1,1) 10 minutes ago
and iClose(Symbol(),PERIOD_M1,1) now, is the same.