Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Анализ результатов тестов и оптимизации в тестере стратегий MetaTrader 5
fxsaber, 2018.01.28 12:25
Индикатор
#property indicator_chart_window #property indicator_plots 0 input long Chart = 0; // идентификатор графика-получателя события input int Index = 0; int OnCalculate( const int rates_total, const int prev_calculated, const int, const double &[] ) { if (prev_calculated) EventChartCustom(Chart, 0, Index, 0, NULL); return(rates_total); }
Советник
input int AmountSymbols = 1; const string Symbols[] = {"EURUSD", "GBPUSD", "AUDUSD", "USDJPY", "USDCAD"}; void OnInit() { for (int i = 0; i < AmountSymbols; i++) if (Symbols[i] != _Symbol) iCustom(Symbols[i], PERIOD_W1, "Spy.ex5", ChartID(), i); // MQL5\Indicators\Spy.ex5 } void OnTick() { OnTick(_Symbol); } void OnChartEvent( const int id, const long &lparam, const double&, const string& ) { if (id == CHARTEVENT_CUSTOM) OnTick(Symbols[(int)lparam]); } // Мультисимвольный OnTick void OnTick( const string &Symb ) { }
...
fxsaber post is one method well described in this article a long time ago.
In summary, you launch an indicator on all symbols to monitor, and these indicators send back an event to the EA when there is a new tick on any of the symbols.
- 2011.02.18
- Konstantin Gruzdev
- www.mql5.com
fxsaber post is one method well described in this article a long time ago.
In summary, you launch an indicator on all symbols to monitor, and these indicators send back an event to the EA when there is a new tick on any of the symbols.
It's clear.
The article is very interesting.
Many thanks for your help, I think I can work on this solution :)
Regards,
Erwann.
You pick ONE symbol for the strategy tester, how do you add the spy into the other's symbol/s?
OH! Dear so you can force a symbol to implement a custom indicator for that reason, thank you sir, really pleased :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm working on an indicator which makes the same calculation process for each symbol of an internal list selected by the user (for exemple : EURUSD, USDJPY, etc...).
The event which initiate a new calculation process for a given symbol shall be a new tick of this symbol.
Important : This indicator is affected to one chart only but shall make the calculation process for all the symbol of the internal list. That means I can't use the basic OnCalculate event function for scan the new ticks of all symbols because OnCalculate event will occurs only when a new tick of the actual selected symbol of the chart occurs.
So finally, I must detect when a new tick of a specific symbol occurs.
My question is :
- how can I create an event of new tick for a list of known symbols ?
- where shall I write this event in my code ?
Thank for your help !
Erwann.