Forum

OrderClose() - error 138

Hi there, i have an issue with OrderClose() command generating error code 138 This seems to work OK, that is: No 138 errors void OnTick () { if ( iTime (symb,timecheck, 0 )>start_current_bar) { <catching some technical indicators> ri= "Cash" ; for (

Changing extern variables

Hi all, if you have the following program extern int var = 0 ; OnInit() { } OnTick() { if ( var == 1 ) { < do something>; var = 0 ; } } If during operation of the EA the value of 'var' is changed to '1' on the chart, the <do something> routine is executed and the 'var' value is set

Signal provider and Asset names

My broker uses EURUSD. (note the ".") as opposed to simply EURUSD Does that mean that my trading system can not be offered as an MT4 Signal? (ie. i'd be a signal provider ) and vice-versa, i can never follow a signal from someone how trades EURUSD? let me know if there is a solution, Thanks

program execution

If i have an EA monitoring my account and able to close all my positions like: OnTimer () //a 1 second timer { If(AccountEquity()>target){ Close all positions with certain MagicNumber}} And at the same time have many EAs on as many Instruments, that Open positions at the same time like: OnTick () {

Accessing variables

Quick question: What takes less milliseconds to process? macd_signal= iMACD (ChartSymbol(), PERIOD_D1 , 8 , 21 , 5 , PRICE_TYPICAL ,MODE_SIGNAL, 1 ) OnTick () { Print (macd_signal); Print (macd_signal+ 1 ); Print (macd_signal+ 2 ); Print (macd_signal+ 3 ); Print (macd_signal+ 4 ); Print

How long is trade open? Exclude non-trading days

In one of my EAs i'm calculating how long a trade is open (in seconds) I used it to test if order were open for longer than a week. In such case the inclusion of a weekend was no factor. As i'm now thinking of testing for shorter periods - 2 or 3 days - the weekend is a factor. On Monday noon, I'd

SendMail() from EA and Chartchange

In my EA I have a simple trigger to send an email something like this: bool email_sent; [....] void OnTimer () { if ([no positions]) email_sent= 0 ; if ([positions open] && [some indicator > some value] && email_sent== 0 ) { SendMail (header,body); email_sent= 1 ; } } It works nicely

EA testing always returns "0" value for CCI indicator

Something is off... I've tested my EA before successfully, but now it does not work. The value for the CCI is always "0". cci_long= iCCI ( ChartSymbol (),cci_timeframe[pos],cci_bars, 6 , 0 ); Print ( " CCI_long = " ,cci_long, " " , iCCI ( ChartSymbol (), PERIOD_M5 , 13 , 6 , 0 ), " "

TimeDayOfWeek() issue

I have a weird one below: The if statement should only be able to return 'true' on Fridays , yet i have this trigger every day for some odd reason and positions close as a result. void OnTick () { <snip> if (TimeHour( TimeLocal ())== 23 && TimeDayOfWeek( TimeLocal ()== 5 )) { Alert (

EX4 write error

Yesterday's upgrade to Win10 Pro version 1511 OSbuild 10586.17 seems to have wrecked the compiler! (I have MetaEditor 5.0.0.1218 ) Cannot compile anything and continue to get "EX4 write error". Starting Editor in compatibility mode doesn't help either... Anybody here experiencing same problems