Hi guys,I have toapologize toGumRai.This morningcalmly andopen marketshaveentered yourcode andIT WORKS!!!! I did not understandwhatwas wrong,becauseI think Ienteredlike last time,but surelyit's methat I'm wrong.Excuse me,GumRai.You are a great!!!
Greetings,Massimo.
int start()
{
staticdatetime BarStart=0;
staticbool 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 1if(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 Rangeif(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 2if(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 Rangeif(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);
}
//-----------------------------------------------------------------------------------------------------------------------------
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, orBars 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
Indicators do not use new bar code. They use either rates_total and previous_calculated, orBars 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
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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.
No worries,
I am just happy that you have it worked out
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.
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