Download MetaTrader 5

Expert Advisors and Indicators

To add comments, please log in or register
Boost
93
Boost  
I have an indicator that uses an onTick () event for one currency pair. I am trying to use that indicator on one currency pair that use on onTick event to trigger a trade for another currency pair. Does the onTick event work in an EA attached to a different currency pair?
onewithzachy
2271
onewithzachy  
Boost:
I have an indicator that uses an onTick () event for one currency pair. I am trying to use that indicator on one currency pair that use on onTick event to trigger a trade for another currency pair. Does the onTick event work in an EA attached to a different currency pair?

Hi Boost,

OnTick() event executed on incoming tick on chart regardless of the symbol name. If you have indicator hard coded to work with - say EURUSD - instead Symbol(), that indicator will still works on non-EURUSD chart - say AUDJPY chart. Same thing on EA. Problem is there's probably a new incoming tick for EURUSD but your CI/EA won't get that EURUSD tick until next AUDJPY tick coming.

Why don't you try it, EA/CI to print EURUSD close and attach it on AUDJPY. 

:D 

Boost
93
Boost  

Thanks for your information.  Is there any way to have a CI executed by an onTick event for say EUR/USD.  And then using that CI attached to the EUR/USD chart to trigger trades on a EA attached to the USD/JPY chart.   

 

What I am trying to do is create a counter for incoming tick on the EUR/USD that is coded in an CI.  For every incoming tick, it adds one to the counter.   For example my EA would attached to the USD/JPY Chart and for every 100th tick on the counter for the EUR/USD would be triggered to buy or sell based on the onTick event for that count.

 

Any ideas? 

onewithzachy
2271
onewithzachy  
Boost:

Thanks for your information.  Is there any way to have a CI executed by an onTick event for say EUR/USD.  And then using that CI attached to the EUR/USD chart to trigger trades on a EA attached to the USD/JPY chart.   

What I am trying to do is create a counter for incoming tick on the EUR/USD that is coded in an CI.  For every incoming tick, it adds one to the counter.   For example my EA would attached to the USD/JPY Chart and for every 100th tick on the counter for the EUR/USD would be triggered to buy or sell based on the onTick event for that count.

Any ideas? 

Hi Boost,

That EURUSD CI writes tick counter to either file (click here) or MT Global Variable (click here), and EA read from it. I prefer MT Global Variable coz it's simple, however if I have to write tick counter from lot of pairs, I think I prefer file.

:D 

Boost
93
Boost  
onewithzachy:

Hi Boost,

That EURUSD CI writes tick counter to either file (click here) or MT Global Variable (click here), and EA read from it. I prefer MT Global Variable coz it's simple, however if I have to write tick counter from lot of pairs, I think I prefer file.

:D 

Thanks.  I think that will work.  Thanks again for your time and input.

 

Alexey Da
Moderator
6648
Alexey Da  

You also can use EventChartCustom function to send events to EA which is placed on the same or on another chart window.

Documentation on MQL5: Working with Events / EventChartCustom
  • www.mql5.com
Working with Events / EventChartCustom - Documentation on MQL5
Boost
93
Boost  
Thanks all.  I think I have come up with a way to get this done.  I really appreciate all your help!  I know I have had this problem before with mql4 , but now I am moving to mql5 I was hoping there is a better.  Seems like there is.  Thanks again alex and onewithzachary.
To add comments, please log in or register