i want this ea buy only when price above 300 ema and 700 ema .
sell when price blow 300 ema and 700 ema .
correct condition please any one
//----------------------- SET VALUE FOR VARIABLE
OpenPricePrevious = iOpen (NULL,TimeFrame,1);
ClosePricePrevious = iClose(NULL,TimeFrame,1);
OpenPriceCurrent = iClose (NULL,TimeFrame,0);
MAValuePrevious = iMA (NULL,TimeFrame,MAPeriod,0,MAMethod,MAPrice,1);
MAValueCurrent = iMA (NULL,TimeFrame,MAPeriod,0,MAMethod,MAPrice,0);
MAValuePrevious700 = iMA (NULL,TimeFrame,MAPeriod700,0,MAMethod,MAPrice,1);
MAValueCurrent700 = iMA (NULL,TimeFrame,MAPeriod700,0,MAMethod,MAPrice,0);
//----------------------- IF NO TRADE
if(total < 1)
{
//----------------------- BUY CONDITION
if(
OpenPriceCurrent >MAValueCurrent700 &&
MAValueCurrent >MAValueCurrent700 &&
OpenPriceCurrent >MAValueCurrent)
{
ticket = subOpenOrder(OP_BUY); // open BUY order
subCheckError(ticket,"BUY");
return(0);
}
//----------------------- SELL CONDITION
if(
OpenPriceCurrent <MAValueCurrent700 &&
MAValueCurrent<MAValueCurrent700 &&
OpenPriceCurrent <MAValueCurrent)
{
ticket = subOpenOrder(OP_SELL); // open SELL order
subCheckError(ticket,"SELL");
return(0);
}
return(0);
sell when price blow 300 ema and 700 ema .
correct condition please any one
//----------------------- SET VALUE FOR VARIABLE
OpenPricePrevious = iOpen (NULL,TimeFrame,1);
ClosePricePrevious = iClose(NULL,TimeFrame,1);
OpenPriceCurrent = iClose (NULL,TimeFrame,0);
MAValuePrevious = iMA (NULL,TimeFrame,MAPeriod,0,MAMethod,MAPrice,1);
MAValueCurrent = iMA (NULL,TimeFrame,MAPeriod,0,MAMethod,MAPrice,0);
MAValuePrevious700 = iMA (NULL,TimeFrame,MAPeriod700,0,MAMethod,MAPrice,1);
MAValueCurrent700 = iMA (NULL,TimeFrame,MAPeriod700,0,MAMethod,MAPrice,0);
//----------------------- IF NO TRADE
if(total < 1)
{
//----------------------- BUY CONDITION
if(
OpenPriceCurrent >MAValueCurrent700 &&
MAValueCurrent >MAValueCurrent700 &&
OpenPriceCurrent >MAValueCurrent)
{
ticket = subOpenOrder(OP_BUY); // open BUY order
subCheckError(ticket,"BUY");
return(0);
}
//----------------------- SELL CONDITION
if(
OpenPriceCurrent <MAValueCurrent700 &&
MAValueCurrent<MAValueCurrent700 &&
OpenPriceCurrent <MAValueCurrent)
{
ticket = subOpenOrder(OP_SELL); // open SELL order
subCheckError(ticket,"SELL");
return(0);
}
return(0);
Attached File(s)