- How to use the select symbol "by Name method" in order to use CSymbolInfo functions?
- How to refresh data on multiple symbols in One script
- can i code the EA that attach in EURUSD chart to open or do something with GBPUSD ?
All the while I've been using functions like iClose("EURUSD",PERIOD_H1,0) to retrieve the latest bid price of EURUSD (or any other pairs)... no need to refresh. What I suspect is that RefreshRates only matter if you're using variables like Ask or Bid... but if you use function calls like iClose, it's automatically get and return you the latest value.
-
After Sleep and between server calls the market will have changed.
You must update your variables. To use any pre-defined variables and series
arrays you must call RefreshRates
RefreshRates - Timeseries and Indicators Access - MQL4 Reference RefreshRates updates:Predefined variables: Ask, Bars, Bid, Close[], High[], Low[], Open[], Point, Time[], Volume[]
RefreshRates - Timeseries and Indicators Access - MQL4 Reference
Predefined Variables - MQL4 Reference
Also updates: Hour, Minute, and Seconds
Minute() returns wrong values - or am I wrong? - MQL4 and MetaTrader 4 - MQL4 programming forum
And updates: OrderClosePrice() on the next order select call. - "Symbol of the card" makes no sense. Perhaps you meant chart.
- There are no pre-defined variables for other symbols. Re-read point 1
Wrong.
-
After Sleep and between server calls the market will have changed.
You must update your variables. To use any pre-defined variables and series
arrays you must call RefreshRates
RefreshRates - Timeseries and Indicators Access - MQL4 Reference RefreshRates updates: - "Symbol of the card" makes no sense. Perhaps you meant chart.
- There are no pre-defined variables for other symbols. Re-read point 1
2. Yes, that's it. English is not my language.
I will consult the links that you propose to me.
But I'm not sure to find my answer, how to update the data of another chart
2. Yes, that's it. English is not my language.
I will consult the links that you propose to me.
But I'm not sure to find my answer, how to update the data of another chart
Refresh rates? Do you know why you need to refresh? and what are the cons for trading?
Now look here :
function run() { set(PARAMETERS); // generate and use optimized parameters StartDate = 20160801; TickTime = 100; BarPeriod = 5; // 5 minutes bars LookBack = 500; // maximum time period // calculate the buy/sell signal with optimized parameters vars Price = series(price()); vars Filtered = series(BandPass(Price,optimize(5,1,240,1),0.5)); vars Signal = series(FisherN(Filtered,500)); var Threshold = optimize(1,0.5,1.5,0.1); // buy and sell Stop = optimize(100,1,200) * ATR(optimize(100,1,200)); Trail = optimize(100,1,200) * ATR(optimize(100,1,200)); if(crossUnder(Signal,-Threshold)) enterLong(); else if(crossOver(Signal,Threshold)) enterShort(); }
Don't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forumWhat part of "1) To use any pre-defined variables … you must call RefreshRates"
What part of "there are no pre-defined variables for other symbols. Re-read point 1" is unclear?
Hello,
I wrote an EA that scans the market. The 28 main pairs. It determines the pair with the highest volatility of the 28 over 3 time horizons.
LOL, I guess I was too vague in my earlier post, and you missed my answer to your question completely.
Basically RefreshRates() is for you to update "predefined variables" for the current symbol - we all know this. Predefined variables are not changed during the execution of our code (so for each OnTick, the values remain constant). Also, predefined variables only exist for current symbol, so RefreshRates() do not have any effect on other symbols.
To retrieve up-to-tick values, we can make calls to MarketInfo() or iClose/iHigh/iLow/iOpen/iTime/iBar suite of functions:
double MarketInfo( string symbol, // symbol int type // information type );
So instead of using Ask, Bid, etc. we can do MarketInfo(Symbol(),MODE_ASK) and MarketInfo(Symbol(),MODE_BID), or iClose iHigh iLow, etc. This way we get the latest tick information without using RefreshRates().
The MarketInfo and iClose suite of functions also allow us to retrieve information of other pairs - there you have your answer. So there is no need for any RefreshRates() function for other symbols/pairs, because when you use MarketInfo() etc functions, you automatically get the latest values.
Now, to go further, if you want to make sure that the latest tick from other pair is at the start of that pair's new bar (i.e. first value of a new candle), you'll probably have to also check the times of those ticks, so that your computation only starts when every pair is in sync - I do that all the time, so I make use of global variables to keep track of times.
I hope I'm clear enough this time round.
Yes, you were pretty clear.
Of course they do, just not synchronously.
Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
On MT5: Unless the chart is that specific pair/TF, you must Synchronize the terminal Data from the Server.
Timeseries
and Indicators Access / Data Access - Reference on
algorithmic/automated trading language for MetaTrader 5
Synchronize Server Data
with Terminal Data - Symbols - General - MQL5 programming forum
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use