| / | Forum |
|
Fishtank
2006.01.24 21:54
Can you store the price in just a variable? So maybe at the end of the EA add a
line of code like:
int Previous_Price; Previous_Price= Ask; Can you store that for the next tick as the EA re-initializes? or does it get wiped out no matter what? Do I need to use an Array even if I ONLY need the previous tick's price data? Or is there a different way I can't think of that's better? |
|
How to Evaluate the Expert Testing Results The article gives formulas and the calculation order for data shown in the Tester report. |
|
CockeyedCowboy
2006.02.18 20:28
Fishtank: If only the last data point is to be saved then check out the Static variable Declarations
capability of MT. In the dictionary > variables > static variable section.
Can you store the price in just a variable? So maybe at the end of the EA add a line of code like: int Previous_Price; Previous_Price= Ask; Can you store that for the next tick as the EA re-initializes? or does it get wiped out no matter what? Do I need to use an Array even if I ONLY need the previous tick's price data? Or is there a different way I can't think of that's better? The CockeyedCowboy |
|
mishka
2006.02.23 01:57
Fishtank,
if you need the Var alive OVER the span of the EA, just use the GlobalVariableXXX set of functions. They retain even if you exit MT4 until you specifically delete them. m CockeyedCowboy: Fishtank: If only the last data point is to be saved then check out the Static variable Declarations
capability of MT. In the dictionary > variables > static variable section.
Can you store the price in just a variable? So maybe at the end of the EA add a line of code like: int Previous_Price; Previous_Price= Ask; Can you store that for the next tick as the EA re-initializes? or does it get wiped out no matter what? Do I need to use an Array even if I ONLY need the previous tick's price data? Or is there a different way I can't think of that's better? The CockeyedCowboy |
|
mikejohnson
2006.03.18 04:38
if you do this...
int rc; double nzdusd[][6]; rc=ArrayCopyRates(nzdusd,"NZDUSD",0); nzdusd[0][4]; //current close price nzdusd[1][4]; //previous close price nzdusd[2[4]; //etc... note, arraycopyrates returns the number of bars read. i found that if i would physically open an nzdusd chart and manually scroll back in time(once for all time frames) this would fill mq's cache and then arraycopyrates will read more bars. |
|
Fishtank
2006.03.21 22:44
Thanks for the responses guys, the GlobalVariableSet/Get functions suited my purpose great. It's always great to learn more ways than
one though!
|