Download MetaTrader 5

Why is there NO Complete EA within the Code-Base? - page 4

To add comments, please log in or register
szgy74
269
szgy74  

Some things to add as EA options:

- unique magic number calculation, maybe foolproof to give the same result when broker changes symbol name (for example from "EURUSD" to "EURUSD.m")

- order management options (trailing stop, break even (these in pips or other values like psar, x bars high/low, ma, etc.), order close)

- extensive order info handling by order ticket (for which a text (or csv) file seems to be the simplest appropriate way). GV is limited, OrderComment() may be changed by the broker.

whroeder1
15551
whroeder1  
Building on IsNYOnDst
datetime TimeSrvToNY(datetime timeSrv=EMPTY){      // Server time to NY time
   if(timeSrv == EMPTY) timeSrv = timeCur_srv;
      #define NY_TZ_STD -5                   // NY is UTC-5 (STD) or UTC-4 (DST)
   int utcToNY = NY_TZ_STD + IsNYonDST(timeSrv);
   return(TimeSrvToUTC(timeSrv) + utcToNY * 3600);  // Previous called TimeGMT
}
datetime TimeNyToSrv(datetime timeNY){
   int utcToNY = NY_TZ_STD + IsNYonDST(timeNY);
   return( TimeUtcToSrv(timeNY - utcToNY * 3600) ); // Previous called TimeServer
}
4x4ever
440
4x4ever  
WHRoeder, are you updating the download link or do we need to manually "patch" the WHRea source with all the updates that you provide in this thread?
whroeder1
15551
whroeder1  
You can't update posts once they become a couple of days old.
4x4ever
440
4x4ever  
I see.. Would you please post the most recent version here again then?
Point Zero
792
Point Zero  
mbirrell:

I am a bit worried about sharing my custom indicators and EAs because if I did and everyone started using them they wouldn't work any more... Does anyone else agree?

I know this sounds a bit selfish... but when I get to 5 million I will share ;-)

Actually if everyone used your Ea, the market price will either be zero or infinite. Everyone will want to buy or sell at the same time.
Mideel
74
Mideel  

Hello guys, is the example in MQL4 tutorial just enough if we only want simple and general solution ?

My EA trade and do calculation per bar and not per tick.


int Fun_Error(int Error)                        // Function of processing errors
  {
   switch(Error)
     {                                          // Not crucial errors           
      case  4: Alert("Trade server is busy. Trying once again..");
         Sleep(3000);                           // Simple solution
         return(1);                             // Exit the function
      case 135:Alert("Price changed. Trying once again..");
         RefreshRates();                        // Refresh rates
         return(1);                             // Exit the function
      case 136:Alert("No prices. Waiting for a new tick..");
         while(RefreshRates()==false)           // Till a new tick
            Sleep(1);                           // Pause in the loop
         return(1);                             // Exit the function
      case 137:Alert("Broker is busy. Trying once again..");
         Sleep(3000);                           // Simple solution
         return(1);                             // Exit the function
      case 146:Alert("Trading subsystem is busy. Trying once again..");
         Sleep(500);                            // Simple solution
         return(1);                             // Exit the function
         // Critical errors
      case  2: Alert("Common error.");
         return(0);                             // Exit the function
      case  5: Alert("Old terminal version.");
         Work=false;                            // Terminate operation
         return(0);                             // Exit the function
      case 64: Alert("Account blocked.");
         Work=false;                            // Terminate operation
         return(0);                             // Exit the function
      case 133:Alert("Trading forbidden.");
         return(0);                             // Exit the function
      case 134:Alert("Not enough money to execute operation.");
         return(0);                             // Exit the function
      default: Alert("Error occurred: ",Error);  // Other variants  
         return(0);                             // Exit the function
     }
  }

1234
To add comments, please log in or register