Some condition it is never met
maybe is never empty value in that if condition
Marius Ovidiu Sunzuiana:
maybe is never empty value in that if condition
It is. The problem is the cross over. As soon as that’s in, it’s not taking trades anymore.
maybe is never empty value in that if condition
Jefferson Metha:
I am not a good programmer but that looks like mql4 to me and i cant see the order send function at all, what i can detect that ur code will do calculations in the background and no condition will be meet hence wont do anything it wont even print a thing
I am not a good programmer but that looks like mql4 to me and i cant see the order send function at all, what i can detect that ur code will do calculations in the background and no condition will be meet hence wont do anything it wont even print a thing
// Buy Rules if (Cross()>0) if (sell_hmaprevious!=EMPTY_VALUE && sell_hmacurrent==EMPTY_VALUE && buy_hmacurrent!=EMPTY_VALUE) { if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "1", 12345, 0, Green)) { Print("Buy order succeeded!"); } } // Sell Rules if(Cross()<0) if(buy_hmaprevious!=EMPTY_VALUE && buy_hmacurrent==EMPTY_VALUE && sell_hmacurrent!=EMPTY_VALUE) { if (OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Bid + stopLoss * Point, Bid - takeProfit * Point, "2", 12345, 0, Red)) { Print("Sell order succeeded!"); } }
fiehejulien:
There is some OrderSend
fiehejulien:
There is some OrderSend
There is some OrderSend
And it’s sending orders, when I remove the crossover
Found Your Error lol please recheckyour cross Function.
int Cross(){ double ROC_2=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,2), ROC_1=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,1); if(ROC_2<=0 && ROC_1>0){return(1);} if(ROC_2>=0 && ROC_1<0){return(-1);} return(0);
Try and remove the last line that will always return Zero
Fix to this
int Cross() { //+======================================= //|Assisted by jeffiq //+======================================= double ROC_2=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,2), ROC_1=iCustom(NULL,0,"ROC1",RPeriod,UsePercent,0,1);bool bull,bear; if(ROC_2<=0 && ROC_1>0)bull; if(ROC_2>=0 && ROC_1<0)bear; // Buy Rules if (Bull) if (sell_hmaprevious!=EMPTY_VALUE && sell_hmacurrent==EMPTY_VALUE && buy_hmacurrent!=EMPTY_VALUE) { if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "1", 12345, 0, Green)) { Print("Buy order succeeded!"); } } // Sell Rules if(Bear) if(buy_hmaprevious!=EMPTY_VALUE && buy_hmacurrent==EMPTY_VALUE && sell_hmacurrent!=EMPTY_VALUE) { if (OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Bid + stopLoss * Point, Bid - takeProfit * Point, "2", 12345, 0, Red)) { Print("Sell order succeeded!");}
But thats wrong i think
Better yet remove Cross functionand put everything in to OnTick and make conditions boolian
Jefferson Metha:
Found Your Error lol please recheckyour cross Function.
Found Your Error lol please recheckyour cross Function.
Try and remove the last line that will always return Zero
Fix to this
But thats wrong i thinkThank you ! its just giving me one error now. If i delet the return(0); itll give me that error.
'}' - not all control paths return a value Automate V0.mq4 20 5
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello.
This EA is getting 0 Errors, but its not taking any trades, when i test it.
Buy Rules :
HMA Trend Indicator = Greenline
ROC = crossing 0 from below or >0
Sell Rules :
HMA Trend Indicator = Redline
ROC = crossing 0 from above or <0
Where is my mistake ?