I'm perhaps going to regret this because I've not worked much with 3 line crossing, but would the following not do it?
int fast=5;
int med=10;
int slo=20;
double fastma=iMA(NULL,0,fast,0,MODE_SMA,PRICE_CLOSE,1);
double medma=iMA(NULL,0,med,0,MODE_SMA,PRICE_CLOSE,1);
double sloma=iMA(NULL,0,slo,0,MODE_SMA,PRICE_CLOSE,1);
double prev_fastma=iMA(NULL,0,fast,0,MODE_SMA,PRICE_CLOSE,2);
double prev_medma=iMA(NULL,0,med,0,MODE_SMA,PRICE_CLOSE,2);
double prev_sloma=iMA(NULL,0,slo,0,MODE_SMA,PRICE_CLOSE,2);
if (fastma<prev_fastma && medma<prev_medma && sloma<prev_sloma) // if they all need to be sloping down
{
if (fastma <medma && fastma < sloma && (prev_fastma>= prev_medma || prev_fastma>=prev_sloma))
{
Alert("Crossed Down");
}
}
Depending on whether the definition of cross is where they touch ar where the sepeparate will dictate where the "=" goes in the last if.
Does this not work effectively? What am I missing?
I'm perhaps going to regret this because I've not worked much with 3 line crossing, but would the following not do it?
Depending on whether the definition of cross is where they touch ar where the sepeparate will dictate where the "=" goes in the last if.
Does this not work effectively? What am I missing?
V
if (fastma < prev_fastma && medma < prev_medma && sloma < prev_sloma) // if they all need to be sloping down
{
if (prev_fastma >= prev_medma && prev_medma >= prev_sloma) // if all must cross simultaneously
}
if (fastma < medma && medma < sloma)
{
Alert("Crossed Down");
}
}
}
I think these conditions might be difficult to fill.
Actually it does not matter, I want to use it for both. If I use an indicator I wont be alerted with false alerts, if I use an EA, well, then it will be more profitable.
When you said it does not matter, then I would assume you don't have any trouble taking a snippet of code/ or a description & turn it into an indicator. Indicator need more work.
You state 3 line cross but the picture shows 4 lines. I'm gonna go with 3 line... let's call it line A, B & C
Correct me if I'm wrong :
There are 3 state that involves any 1 pair of lines : A == B, A > B, A < B.
Note that A can interact with B, A with C and B with C and they do these simultaneously.
you can completely analyze all states if you do permutation of all of the above combination. But that won't be too useful IMO. So you should narrow it down to what you think is useful as a strategy. For instance make the third line have much greater period. Check this first if it's a down slope for instance, then check if the other two is crossing the same direction.
You also need to use proper line-cross check. With Arrays or current & prev variables. search for it.
engcomp:
I think these conditions might be difficult to fill.
I agree, notably if all three lines need to be sloping in the right direction at the moment of cross. Without that condition, I think it's pretty straight forward. It depends on the actual conditions needed by OP. EG if the cross happens before sloma slopes correctly, how many bars are you going to give it that it's still a valid cross. Expanding that would be fairly straight forward though by taking a time at the cross and then including an allowable period on ibarshift on the slope argument. IMHO the brief needs tightening up :).
Also used interchangeably with "original post"...sometimes the OP themselves will refer back to the "OP" meaning the the first post in the thread. Context determines whether "OP" means poster or poster's post.
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'm perhaps going to regret this because I've not worked much with 3 line crossing, but would the following not do it?
Depending on whether the definition of cross is where they touch ar where the sepeparate will dictate where the "=" goes in the last if.
Does this not work effectively? What am I missing?
V
I'm perhaps going to regret this because I've not worked much with 3 line crossing, but would the following not do it?
Depending on whether the definition of cross is where they touch ar where the sepeparate will dictate where the "=" goes in the last if.
Does this not work effectively? What am I missing?
V
Hey cameofx,
Actually it does not matter, I want to use it for both. If I use an indicator I wont be alerted with false alerts, if I use an EA, well, then it will be more profitable.
When you said it does not matter, then I would assume you don't have any trouble taking a snippet of code/ or a description & turn it into an indicator. Indicator need more work.
You state 3 line cross but the picture shows 4 lines. I'm gonna go with 3 line... let's call it line A, B & C
Correct me if I'm wrong :
Hope that helps
cameo
I think these conditions might be difficult to fill.
I agree, notably if all three lines need to be sloping in the right direction at the moment of cross. Without that condition, I think it's pretty straight forward. It depends on the actual conditions needed by OP. EG if the cross happens before sloma slopes correctly, how many bars are you going to give it that it's still a valid cross. Expanding that would be fairly straight forward though by taking a time at the cross and then including an allowable period on ibarshift on the slope argument. IMHO the brief needs tightening up :).
V
Viffer,... what's OP? I heard that a lot. Open Price, Other Person?
Viffer,... what's OP? I heard that a lot. Open Price, Other Person?
Original Poster
http://www.urbandictionary.com/define.php?term=op
Also used interchangeably with "original post"...sometimes the OP themselves will refer back to the "OP" meaning the the first post in the thread. Context determines whether "OP" means poster or poster's post.