Download MetaTrader 5

OrderClose() change value from TP to 0.00000

To add comments, please log in or register
bisewski
272
bisewski  

Hi.

When I open a new order, I always use the takeProfit and stopLoss prices.

When I close this order opened with the terminal this values remain in historical grid. There are many values, the price close, date, tp and sl and others.

My problem is that when I close an order with my script using OrderClose the value in tp (takeProfit) is changed to 0.00000

                              bool sucess0 = OrderClose(Ticket,vol,closePrice,Slippage,Show_Arrow);
                              if (sucess0 == true)
                              {
                                 RefreshRates();
                                 
                                 bool sucess = OrderSelect(Ticket,SELECT_BY_TICKET,MODE_HISTORY);
                                 if (sucess == true)
                                 {

I dont have any errors and this value in tk also is verifyed in grid historical direct in mt4 not only in OrderTakeProfit().

I use the version 4.00 Build 646 from MBTrading.

Thanks

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Did SL also changed to 0.00000 ?
bisewski
272
bisewski  
deysmacro:
Did SL also changed to 0.00000 ?


No, only TP...all other informations continue correct...

I see this error because when I close an order I need to calculate same information with the TakeProfit and StopLoss...

sds

EDIT1: See this attached image. See that only in the last order that I close direct in mt4 the value is showed correct.

Sorry my english and thanks for your help.

EDIT2 : To complement this value like 0.00000 in TP had correct values like 1.39587 for exemple. But when I close the order TP is changed to 0.00000.

bisewski
272
bisewski  

I make a new test. I create this script:

//+------------------------------------------------------------------+
//|                                                        teste.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
     OrderSelect(OrdersTotal() - 1,SELECT_BY_POS,MODE_TRADES); 
     OrderClose(OrderTicket(),1,Ask,5,clrRed);
  }
//+------------------------------------------------------------------+

I open manually in mt4 an order with sl and tp values. When I start this script it close this order and again change the value TP to 0.00000.

So I think that it is a problem in mt4...Am I Correct? Is possible make anything?

Alain Verleyen
Moderator
32028
Alain Verleyen  
bisewski:

I make a new test. I create this script:

I open manually in mt4 an order with sl and tp values. When I start this script it close this order and again change the value TP to 0.00000.

So I think that it is a problem in mt4...Am I Correct? Is possible make anything?

I can't reproduce this. Which build are you using ?
bisewski
272
bisewski  
bisewski
272
bisewski  
See the vídeo attached. I show the steps...
Files:
teste.zip 2264 kb
bisewski
272
bisewski  
bisewski:
See the vídeo attached. I show the steps...


the mql4 isn't more reliable...many problem in the last version...I understanding that to improve, a little mess happens but today I cant dedicate me to get money, I only correct my code and correct code again...

Alain Verleyen
Moderator
32028
Alain Verleyen  
bisewski:


the mql4 isn't more reliable...many problem in the last version...I understanding that to improve, a little mess happens but today I cant dedicate me to get money, I only correct my code and correct code again...

You can talk to your broker AND/OR report this to the ServiceDesk of Metaquotes.
bisewski
272
bisewski  
angevoyageur:
You can talk to your broker AND/OR report this to the ServiceDesk of Metaquotes.

I open in mql5 and I send an email for MB but at know I dont receive any reply...
Alain Verleyen
Moderator
32028
Alain Verleyen  
bisewski:

I open in mql5 and I send an email for MB but at know I dont receive any reply...
Which ticket number ?
12
To add comments, please log in or register