Download MetaTrader 5

please,i need help for initialisation problem

To add comments, please log in or register
itriad
162
itriad 2013.12.24 02:50 
This simple code,add 10 to initial equity value (1000) each second until it reach 1200,now what i want to do if possible?, is fixing value to 1200 .
after if my metatrder4 shutdown and restart,de counting process must begin from 1200 and not the old value of 1000.

thank for any help

//+------------------------------------------------------------------+
//|                                                         loop.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

double initialequity = 1000.0;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {   
   initialequity =initialequity ; //is possible to put new value 1200 here ????
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  
      
      while(initialequity<1200)
      {
      initialequity +=10.00;
      Print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>initialequity ",initialequity);
     
      
      Sleep(1*1000);//sleep in miliseconds, so use 60*1000 to change to minute
      }

//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Ubzen
5394
Ubzen 2013.12.24 04:46  
riskoff:
This simple code,add 10 to initial equity value (1000) each second until it reach 1200,now what i want to do if possible?, is fixing value to 1200 .
after if my metatrder4 shutdown and restart,de counting process must begin from 1200 and not the old value of 1000.

thank for any help

If you want a variable to keep its value after restart then make it a Global Variable. https://docs.mql4.com/globals.
To add comments, please log in or register