What's new

Cross - expert for MetaTrader 4

channet200

New Member
Simple code for Candle Cross above or below Conditions..

Mt5 version:- https://www.mql5.com/en/code/27597

Note: This is just a sample

Main Function


bool crossed[2];

//+------------------------------------------------------------------+
int OnInit()
{
for (int i = 0; i < ArraySize(crossed); i++)
crossed = true;
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnTick()
{
//Your Buy condition
if(Cross(0,Open[0] > Condition))
{

....//your conditions//...

}

//Your Sell condition
if(Cross(1,Open[0] < Condition))
{

....//your conditions//...

}
}
//+------------------------------------------------------------------+
bool Cross(int i, bool condition)
{
bool ret = condition && !crossed;
crossed = condition;
return(ret);
}
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)

Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock    No Thanks