Retard the alert several seconds - page 5

 
Hi guys, I have to apologize to Gum Rai. This morning calmly and open markets have entered your code and IT WORKS !!!!
I did not understand what was wrong, because I think I entered like last time, but surely it's me that I'm wrong. Excuse me, GumRai. You are a great !!!

Greetings, Massimo.


int start()
{
  static datetime BarStart=0;
   static bool check=false;
    if(BarStart!=Time[0])
     {
      BarStart=Time[0];
      check=true;
     }
   if(check && TimeCurrent()>=Time[0]+3)
     {
      check=false;
      //Check Condition
    

//_________________________________

/*void OnTimer(){
{
if(Bars!=prev_bars) current_candle_alert_been=false;
prev_bars=Bars;

if(current_candle_alert_been) return;
if(TimeLocal()-time_dif<Time[0]+seconds) return;
current_candle_alert_been=true;
 */    
      //Indicator Buffer 1
      if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) < 30
      
      )
        {
         Buffer1[0] = Low[0] - iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick Low - Average True Range
         if(0 == 0 && Time[0] != time_alert) { myAlert("indicator", "Buy"); time_alert = Time[0]; } //Instant alert, only once per bar
        }
      else
        {
         Buffer1[0] = 0;
        }
      //Indicator Buffer 2
      if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) > 70
     
      )
        {
         Buffer2[0] = High[0] + iATR(NULL, PERIOD_CURRENT, 14, 0); //Set indicator value at Candlestick High + Average True Range
         if(0 == 0 && Time[0] != time_alert) { myAlert("indicator", "Sell"); time_alert = Time[0]; } //Instant alert, only once per bar
        }
      else
        {
         Buffer2[0] = 0;
        }
     }
      
return(0);
}
 //-----------------------------------------------------------------------------------------------------------------------------


 

No worries,

I am just happy that you have it worked out

 
GumRai: But what you are saying is that Bars increases by adding earlier data to a chart. So that means that by adding the earlier bars, the return from bars will increase, so using Bars instead of Time[] will detect a new bar even when there has not been a new bar?

Exactly.

Indicators do not use new bar code. They use either rates_total and previous_calculated, or Bars and IndicatorCounted() so they recalculate the newly added earlier data.

EA's use the Time[0] new bar code to detect a new bar.

Example on the daily: Thursday=[1] Friday=[0] Bars=2

Then history is added: Tuesday=[3], Wednesday=[2] Thursday=[1] Friday=[0] Bars changed to 4 but the day is still Friday: no new day.

Bars is unreliable (a refresh/reconnect can change number of bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
 
WHRoeder:

Exactly.

Indicators do not use new bar code. They use either rates_total and previous_calculated, or Bars and IndicatorCounted() so they recalculate the newly added earlier data.

EA's use the Time[0] new bar code to detect a new bar.

Example on the daily: Thursday=[1] Friday=[0] Bars=2

Then history is added: Tuesday=[3], Wednesday=[2] Thursday=[1] Friday=[0] Bars changed to 4 but the day is still Friday: no new day.


Ye ye, ofcourse. You are wrong again. No new day. But there are new bars-data-days and you need to recount all data in indicator or EA.

 

I know this thread is old but could you please help me check the attached indicator. I want the arrow to appear 90s before the event happens. i have tried numerous solutions but i dont seem to get it right. i would have pasted the code itself but its above 64000 

https://pastebin.com/XSHR9ZvH


thanks

Files:
 
Ibiso Irumudomon: I want the arrow to appear 90s before the event happens.
So do we all. There are no mind readers here and our crystal balls are cracked. Until the market moves enough to create your signal, there is no signal.
Reason: