abolk: But until you describe what you want, it's just hard to help you
You have two signals
double tr0=iCustom(NULL,0, "trd",0,0);//may be 0 or 1 . If 1, then buy double tr1=iCustom(NULL,0, "trd",1,0);//may be 0 or 1. If 1 we sell
I will talk about selling
When tr1 is equal to 1 after the next tick, then the check starts at the time t to see if the unit will hold since t for the time period tim . The check is carried out at intervals of time delta. As an example we take t=........ //10.00 hour, tim = 600 sec, delta = 60 sec. So at 10.00 there is tr1=1 (before it was 0). But we will not sell it. The sale will be confirmed if the signal reaches 600 sec, i.e. 10.10. The check is not performed all the time, but in time intervals delta=60 sec (10.00, 10.01, 10.02, ....... , 10.09, 10.10). And if at each check tr1=1, then we give a sell signal.
There is also a disadvantage - zero can appear between each check and the signal may be false. Checks can be simplified, but the computer gets very busy. You should find the golden mean in this case and see what happens. This is all for experimentation.
void init()
{
isSign=false;
}
void start() // запускается с каждым тиком
{
if(!isSign) // если сигнала нет
{
sign0=???; // формула определения signif(sign0==1) // если сигнал поступил
{
t0=TimeCurrent(); //фиксируем время
isSign=true; // переключатель - сигнал поступил
}
}
if(isSign) // если сигнал есть
{
t=TimeCurrent(); // новое время
if(t<=t0+delta) // если временной промежуток не закончился
{
sign1=???; //формула определения нового сигналаif(sign1!=sign0) // если новый сигнал изменился (не продержался)
{
isSign=false; // переключатель - сигнала нет
}
}
if(t>t0+delta) // если промежуток закончился
{
if(isSign) // если сигнал удержался
{
//действия по сигналу
}
}
}
}
The signal sig_bye== 1. If 0 the timer does not start set the bay timer. If signal ==1, leave the bay timer idle. If the signal sig_bai== 0. then reset the bay timer.
timer counts down 5 minutes at intervals of, let's say, one minute twice, so we'll work in bai.
When signal sig_beam goes off== 1. If 0, timer won't start. turn on the timer sel. If the signal Sat_en_esel==1, leave the sleep timer idle. If a Sig_sel==0 signal arrived, reset the selftimer. the timer counts down for 5 minutes at one minute intervals, say twice a minute, then reset.
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.
This is taken from Moving Average.mq4
There were no such strings )) You must have changed the EA code yourself some time ago, and now you're guided by these entries yourself )
Sorry, maybe I've got it wrong. I based my code on Moving Average.mq4 and made changes on it.
I'm not Russian and sometimes it's hard for me to describe what I want.
I am not Russian and sometimes I find it hard to describe what I want.
But until you describe what you want, it's just hard to help you
You have two signals
double tr0=iCustom(NULL,0, "trd",0,0);//may be 0 or 1 . If 1, then buy
double tr1=iCustom(NULL,0, "trd",1,0);//may be 0 or 1. If 1 we sell
I will talk about selling
When tr1 is equal to 1 after the next tick, then the check starts at the time t to see if the unit will hold since t for the time period tim . The check is carried out at intervals of time delta. As an example we take t=........ //10.00 hour, tim = 600 sec, delta = 60 sec. So at 10.00 there is tr1=1 (before it was 0). But we will not sell it. The sale will be confirmed if the signal reaches 600 sec, i.e. 10.10. The check is not performed all the time, but in time intervals delta=60 sec (10.00, 10.01, 10.02, ....... , 10.09, 10.10). And if at each check tr1=1, then we give a sell signal.
There is also a disadvantage - zero can appear between each check and the signal may be false. Checks can be simplified, but the computer gets very busy. You should find the golden mean in this case and see what happens. This is all for experimentation.
There are two signals
double tr0=iCustom(NULL,0, "trd",0,0);//may be 0 or 1 . If 1 we buy
double tr1=iCustom(NULL,0, "trd",1,0);//may be 0 or 1. If 1 we sell
It is not clear, can two different (contradictory) signals be received at the same time?
It is not clear, can two different (conflicting) signals be received at the same time?
No, it is not. They are taken from different buffers and only one of them can get one. Possible combinations
tr0 0 1 0
tr1 0 0 1
1 and 1 is an impossible combination
Check with each tick, not at discrete intervals
Sorry if I've made a mistake.
No, it can't. They are taken from different buffers and only one of them can give 1. Possible combinations
tr0 0 1 0
tr1 0 0 1
1 and 1 is an impossible combination
signal == 1.
activate the override timer.
if signal == 1. do not set the override timer.
if signal == -1, then reset the Buy timer and set the Buy timer to Buy.
if the signal == -1. do not touch the sell timer.
if the signal came 0 reset both timers to zero.
If timer counts down for 5 minutes, then we're good to go.
The signal sig_bye== 1. If 0 the timer does not start
set the bay timer.
If signal ==1, leave the bay timer idle.
If the signal sig_bai== 0. then reset the bay timer.
timer counts down 5 minutes at intervals of, let's say, one minute twice, so we'll work in bai.
When signal sig_beam goes off== 1. If 0, timer won't start.
turn on the timer sel.
If the signal Sat_en_esel==1, leave the sleep timer idle.
If a Sig_sel==0 signal arrived, reset the selftimer.
the timer counts down for 5 minutes at one minute intervals, say twice a minute, then reset.
Check with each tick, not at discrete intervals
Sorry if I've made a mistake.
All ticks are unacceptable.