need help - page 2

 
mrluck1: I did all you said,
No you didn't.

4. Correct your TP and SL

5. Understand that == is not good to use when comparing doubles. Check for a cross instead.

7. Understand that you should check the return code of OrderSend()
 
whroeder1:
No you didn't.
could you show me the code, because i dont understand what to do to TP and SL, and the cross, and the return code, because i dont understand it, but if i could see a correct code, i would
 
OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);

Start with the SL and TP on your SELL order

Then read this about function return values. 
 
honest_knave:
OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);

Start with the SL and TP on your SELL order

Then read this about function return values. 

yes but what numbers should i put? I copied this from mql4 book, so what is the correct way and where do i find it?

about return values, if ordersend is a bool if i correlate it with some other bool, like put bool a= true; , and then a= ordersend... , the message goes off, but still it doesnt work.

But about sl and tp, what should i do, thanks

void OnTick()
  {
//---
   double Lot=0.01;
   bool cond1=false;
   double ichimoku= iIchimoku(NULL,5,9,26,52,4,0); // pegar o valor do ichimoku1
   bool a=true;
          
   if(Bid==ichimoku)

     { cond1=true;}

  if (cond1=true)

      {a= OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Bid -10 *Point,Ask+10 *Point);}
  }


 

 
mrluck1:

yes but what numbers should i put? I copied this from mql4 book, so what is the correct way and where do i find it?

Are you sure you copied it exactly?

Think it through logically:

  • You are placing a sell order.
  • Should the SL be higher or lower than the order price?
  • Should the TP be higher or lower than the order price? 

mrluck1:

about return values, if ordersend is a bool if i correlate it with some other bool, like put bool a= true; , and then a= ordersend... , the message goes off, but still it doesnt work.

If you are serious about wanting to learn to code MQL4, the documentation is where you will find most of your answers.

Here is the entry for OrderSend().

Does it return a bool or something else?

If the OrderSend fails, would you like to know why? Or do you prefer to guess? 

Wouldn't it be great if you made a mistake with your SL, or your lot size, and your code told you what the problem was? Error codes!

OrderSend - Trade Functions - MQL4 Reference
OrderSend - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderSend - Trade Functions - MQL4 Reference
 
if ordersend is a bool

It does not return a bool. It returns the ticket number if successful or -1 if it fails.

Have you read the documentation? It's there, plain to see.