Forum

Sleep and RefreshRates

I've noticed some codes Sleep at the start of a code then Refreshes to update values before continuing with the rest. Is it not better to Sleep at the end of the code? Then RefreshRates is not required? edit: should probably specify purpose: to make sure the code only runs once per second for

How many MT4 terminals could this laptop run?

Asus Transformer Book T100 . Intel Atom Z3740 1.33GHz Quad Processor, 32GB SSD, 2GB DDR3, Intel HD Graphics, Win 8.1 I didn't find much in the way of minimum specifications for MT4 but I want to run this laptop 24/7, do you think I could run 12 MT4 EA terminals? The EAs aren't really that intensive

Writing a file to the common folder (script)

I tried writing to the following common MT4 folder in Windows 8 but it isn't working: string BaseDirectory = "C:\Users\<name>\AppData\Roaming\MetaQuotes\Terminal\Common" ; int FileHandle = FileOpen (BaseDirectory+ "\\thefile.txt" , FILE_WRITE | FILE_CSV ); FileWrite(FileHandle, TimeCurrent ());

Intermittent divide by zero error

My EA was giving me an intermittent divide by zero error while doing backtests of AUD/NZD. The journal pointed the source of the error to my lot size calculation below, specifically the (1/NUrate) part. double NUrate = iClose ( "NZDUSD" , 0 , 0 ); //also tried MarketInfo("NZDUSD",MODE_BID) Lots =

OrderModify error 1 during back testing

I have some code to break even when price reaches a particular point but I keep getting OrderModify Error 1 in the journal. The code works absolutely fine and does its job of break even at the correct point, I just keep getting the error clogging up the journal after that happens. for ( int

XAG/USD's lot size

Something I learned recently was that when trading 1 lot of XAG/USD, the value per pip can vary depending on the broker. For example, on SVS Securities broker, if you buy 1 lot, each pip movement is worth $50.00. And on Admiral Markets broker, buying 1 lot means each pip movement is worth $5.00

MT4 updates and 24/7 EAs (and other questions)

If there is an update to MT4 and I am a running an EA 24/7, what happens? Does it just keep going as normal? Or does it auto-update then restart itself? Can you run two different EAs on two different chart windows on the same account (same terminal)? How many instances of MT4 can I have running at

Was return(0) important?

Just a curiosity question more than anything, since I deleted most of the return(0)s in the old build with no ill effects. The new 600 build debugger keeps telling me off if I accidentally copy and paste return(0); into the void OnTick section. My solution was to delete return(0)

Using switch to determine the AccountCurrency() ?

I tried the following but it didn't work. The error in compiling says it expected each case to be an integer but I have strings such as "USD", "EUR", etc. double USDBalance; switch ( AccountCurrency ()) { case "USD" : USDBalance = AccountBalance (); break; case "GBP" : USDBalance =