My MT4 could not handle buy order and timeframe properly?

 

Hi,

When I try to test this code which located: https://www.mql5.com/en/code/10576, I find it only has sell trade, after check the code, find the MT4 could not handle buy order properly, could place lost stop on buy order. I couldn't modify buy order eighter.

And when I try to change the time from for iADX, it seem not work at all.

Could any body help?


Thanks a lot

 
  1. Doesn't adjust for 4/5 digit brokers
  2. Doesn't test return codes
  3. Assumes it is the only EA running on once chart.
  4. Uses no SL
  5. CloseAllInProfit closes all of that type.
  6. Adds additional trades to a loosing one.
  7. Direction depends on your settings - nothing obvious. Did you have history for the time frame you selected?
  8. How should we know why you "couldn't modify buy order eighter" without seeing YOUR code?
  9. How should we know why "ADX, it seem not work at all" without seeing YOUR code? No mind-readers here.
 

Hi,

Thanks for your reply.

Here is code I try :


ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"MLTrendETF",16384,0,Red);

OrderModify(OrderTicket(),OrderOpenPrice(),Ask-0.018,Ask+0.006,0,Red);


It doesn't modify the order.


Thanks

 

Did you check the return value from the OrderModify ? and if it didn't work what was the Error ?

 

This code:

ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"MLTrendETF",16384,0,Red);



 OrderModify(OrderTicket(),OrderOpenPrice(),Ask-0.018,Ask+0.006,0,Red);

will not modify a position because you miss this in between:

OrderSelect(ticket,SELECT_BY_TICKET);

or you can use it like this:

OrderModify(ticket,Ask,Ask-0.018,Ask+0.006,0,Red);
 
JDeel:

This code:

will not modify a position because you miss this in between:

or you can use it like this:

Nope, that isn't correct.

If Ask has changed between placing the Order and trying to Modify it then you can't use Ask . . . use OrderOpenPrice.

 

Thanks your reply,

but I have an other problem, I can use this one:

iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,1);

But when I try to use

iADX(NULL,7,14,PRICE_CLOSE,MODE_PLUSDI,1);

iADX return 0.

Could you please help?

Thanks

 
Read the documentation: iADX what is timeframe 7 ? timeframes
 

Thanks, I should put 1440 for day time frame.

But I see a lot: Zero divide

it is because I miss some data? Where I can get a complete data?


Thanks

 
MyDream:

Thanks, I should put 1440 for day time frame.

But I see a lot: Zero divide

Zero divide is where you have a calculation where you divide one variable by another and the second is zero, example: a=10, b=0, c = a/b

You need to check the values that you are using to divide with . . .

 
MyDream:

Thanks, I should put 1440 for day time frame.

No you should use the provided constants PERIOD_D1