Forum

Need help with a line of code

Trying to decipher the last line of code in this segment: int counted_bars= IndicatorCounted (); if (counted_bars< 0 ) return (- 1 ); //check for possible errors, -1 returned in log if true. start() ends and waits until next tick if (counted_bars> 0 ) counted_bars--; int limit=

Help with EA ... not closing trades in tester

I am working on an EA, but no matter what I do, I can't make it close trades. It opens them just fine, but when I want them closed, the EA will not close them. I'll post part of my EA code so maybe one of you experienced coders can figure out why I'm having this problem. The vars 'buyTrade' and

calling iCustom in EA

If I call a custom indicator in an EA using iCustom, what price is used (O,H,L,C) to calculate the indicator value? Is is 'close' price by default

How to account for weekend time?

I need some help to account for weekend time. I am writing a script that keeps track of time trades are open. However, no matter what I can't figure out the code to make it subtract the 'weekend time' from the total time that trades are open. Help! Any ideas? Here is the code I am working with: for

time function for dates of backtest?

The tester has the option for choosing "use date ... from ... to" for any particular backtest . If I wanted to those same dates to print out as comment on the screen, is there a time function that returns that particular date range that I specify for the test? Is there a buit-in function for this

Is it possible to pass 2 one-dimensinal arrays to a function?

Just as the questions says, and if so, how? Or, can only one array be passed to function ? For example, if I needed 2 data sets, I would have to combine them to form a 2-dimensional array...? Thanks

How can I calculate MAE/MFE for currency crosses in script?

Hi, I'm writing a script for calculating the MAE/MFE (maximum adverse excursion, maximum favorable excursion) with the strategy tester. So far, my script works great for currency pairs that are either quoted in USD (ie - GBPUSD, EURUSD, etc) or when the USD is the base (ie - USDJPY). By the way, my

High and low between OrderOpenTime() and OrderCloseTime()

I have a dilemma: Since iTime() returns an integer value corresponding to the number of seconds since 1/1/70 (UNIX time), is it possible to break down and access OrderOpenTime() and OrderCloseTime() to the same level? Suppose I am looking for the high or low value between the order open time and the

quick question on MODE_POINT

Just had a noob question that I'm sure has been asked a hundred times over. Nevertheless, I am asking it again hoping someone can just answer. I'm using the MarketInfo ("USDJPY", MODE_POINT); function , and my broker, IBFX, is a 3/5 decimal broker. I tried to use a Comment ( Point ); and also

How to get data from orders generated in strategy tester (offline) and write to .csv file ?

Hi everyone, I'm trying to run a backtest on an EA (using offline charts), and then call a routine from the deinit() function that will extract certain information about each trade generated in the strategy tester. (On a side note - specically, I am working on getting the drawdown (and run up) stats