Unlikely to happen - can price != price?
but just a warning "return value of ordersend should be checked".
Hi friends, i need help to code this simple EA, but it doesnt work on strategy tester, when i compile it it doesnt show any error, but just a warning "return value of ordersend should be checked". So what should i do to
this work? thanks
OnInit is the wrong section for this code
1- I tried to google it yesterday, but only found issues related to builders, but its a code created by me, when i put on tester it doesnt make any trade.
2- if (bid==ichimoku) i think can happen, because ichimoku line is != than price for the most part of time. iIchimoku gets the ichimoku value, right?
3- So Oninit isnt recommended, so in what fuction it will work best?
Can anyone show me a code that can work, i would really apreciate, thanks for the help
1- I tried to google it yesterday, but only found issues related to builders, but its a code created by me, when i put on tester it doesnt make any trade.
2- if (bid==ichimoku) i think can happen, because ichimoku line is != than price for the most part of time. iIchimoku gets the ichimoku value, right?
3- So Oninit isnt recommended, so in what fuction it will work best?
Can anyone show me a code that can work, i would really apreciate, thanks for the help
Several reasons why it is very unlikely:
- Unless Bid is EXACTLY equal to ichimoku during the OnInit() call... no order. OnInit() is only called once.
- Even if you move it to OnTick(), you will still find it unlikely that Bid is EXACTLY equal to ichimoku.
- You set ichimoku to 5 (MODE_CHIKOUSPAN) and call shift 0. This will always be 0.
honest_knave Unless Bid is EXACTLY equal to ichimoku during the OnInit() call... no order. Bid is EXACTLY equal to ichimoku.
| The == operand. - MQL4 forum |
Can someone provide me a functional code, if price= ichimoku tenkansen, then ordersend
for educational purpose. Thank you very much
Your code is close.
1. Move it all from OnInit() to OnTick()
2. Change the mode:
3. Simplify:
{ OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);}
4. Correct your TP and SL
5. Understand that == is not good to use when comparing doubles. Check for a cross instead.
6. Understand that you should check your lotsize before placing an order
7. Understand that you should check the return code of OrderSend()
I did all you said, put on Ontick, changed to tenkansen mode, with still only that warning message, but no trade at all, could you help me again?
{
//---
double Lot=0.01;
bool cond1=false;
double ichimoku= iIchimoku(NULL,5,9,26,52,MODE_TENKANSEN,0); // pegar o valor do ichimoku1
if(Bid==ichimoku)
{ OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);}
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi friends, i need help to code this simple EA, but it doesnt work on strategy tester, when i compile it it doesnt show any error, but just a warning "return value of ordersend should be checked". So what should i do to
this work? thanks
{
//---
double Lot=0.01;
bool cond1=false;
double ichimoku= iIchimoku(NULL,5,9,26,52,5,0); // pegar o valor do ichimoku1
if(Bid==ichimoku)
{ cond1=true;}
if (cond1=true)
{ OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);}
return(INIT_SUCCEEDED);
}