Getting the pre-modified value after closing Metatrader

 

Let's say that we modified the stop loss of an order with OrderModify() and then we closed our computer.

How can we get the original first stop loss of the order after opening the computer next day?

Is it possible in MQL 4?

Thanks.

 
Batuhan:

Let's say that we modified the stop loss of an order with OrderModify() and then we closed our computer.

How can we get the original first stop loss of the order after opening the computer next day?

Is it possible in MQL 4?

Thanks.

its possible simple

//+------------------------------------------------------------------+
//|                                                    StopSakla.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                      https://www.haskayabilgi.com|
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, HaskayaFX  Corp."
#property link      "https://www.haskayabilgi.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   double StopDeger=0;
   int total=OrdersTotal();
   for (int i = 0; i < total; i++) 
      {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)        break;
      StopDeger=GlobalVariableGet("OrderTicket"+OrderTicket());
      Print("OrderTicket: "+OrderTicket()+ " Stop Value: "+StopDeger);
      }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {

  int total=OrdersTotal();
   for (int i = 0; i < total; i++) 
      {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)        break;
      GlobalVariableSet("OrderTicket"+OrderTicket(),OrderStopLoss());
      }
    
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   
  }
//+------------------------------------------------------------------+
 
or 

bool  TerminalClose(
   int ret_code      // closing code of the client terminal
   );

 
Batuhan:

Let's say that we modified the stop loss of an order with OrderModify() and then we closed our computer.

How can we get the original first stop loss of the order after opening the computer next day?

Is it possible in MQL 4?

  1. Any values not saved in persistent storage (files or GV+Flush.) has been lost.
  2. There is no "original first stop loss" unless you saved it, and recovered.
  3. Of course.
 
Thanks a lot guys for your helps.