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); } //+------------------------------------------------------------------+
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.