Which comes first, indicators or experts?

 

I have an indicator that sets some global variables.

I have a few EA's that use the global variables.

Will the indicator execute first, then the EA's or are they done at the same time?

The EA's are on many different pairs.

Thanks

-Non.

 
nondisclosure:

Will the indicator execute first, then the EA's or are they done at the same time?

I am not sure if there's an answer to this (I mean perhaps there is no assured order of execution), but regardless - I think u should design the EA/Indicator to handle BOTH cases...
 
gordon wrote >>
I am not sure if there's an answer to this (I mean perhaps there is no assured order of execution), but regardless - I think u should design the EA/Indicator to handle BOTH cases...


I'm thinking your right.

I'm thinking of putting a sleep() statement at the front of the EA to give the indicator time to calculate. Thoughts?

 
This is interesting... In general, indicators / conditions arised from indicators are best evaluated one time after bar closed. I am not sure what's the nature of your GV that requires every tick evaluation. Perhaps put a counter flag in the indy. And make the EA check if it's greater than last flag then It can only execute based on that new incoming value.
 
nondisclosure:


I'm thinking your right.

I'm thinking of putting a sleep() statement at the front of the EA to give the indicator time to calculate. Thoughts?

I was thinking more in the lines of: IF (GV not exist) sleep/return ELSE do whatever...

So as I said - 'u should design the EA/Indicator to handle BOTH cases'. Don't assume that either one will execute first.

 
cameofx:
This is interesting... In general, indicators / conditions arised from indicators are best evaluated one time after bar closed. I am not sure what's the nature of your GV that requires every tick evaluation. Perhaps put a counter flag in the indy. And make the EA check if it's greater than last flag then It can only execute based on that new incoming value.
ND, I may have assumed incorrectly. Regardless if it's every tick checking or at bar close your question still persist.
I was thinking more in the lines of: IF (GV not exist) sleep/return ELSE do whatever...
So as I said - 'u should design the EA/Indicator to handle BOTH cases'. Don't assume that either one will execute first.

gordon, if I'm not mistaken GV will remain existed after first time setting it. Unless you deleted it.

To verify & make sure the EA access the latest GV value after the Indicator has changed it . I might use this : GlobalVariableSetOnCondition. I just read this & haven't play with it but the function description is very fitting coincidentally :)

... The function provides atomic access to the global variable, this is why it can be used for providing of a semaphore at interaction of several experts working simultaneously within one client terminal.

regards

cameo

 
cameofx:

gordon, if I'm not mistaken GV will remain existed after first time setting it. Unless you deleted it.

To verify & make sure the EA access the latest GV value after the Indicator has changed it . I might use this : GlobalVariableSetOnCondition. I just read this & haven't play with it but the function description is very fitting coincidentally :)

It was just an example... I'll rephrase: IF (indicator not done executing) sleep/return ELSE do whatever...
 
gordon:
It was just an example... I'll rephrase: IF (indicator not done) sleep/return ELSE do whatever...
Sorry, didn't mean to nitpick... :) Btw do you think GlobalVariableSetOnCondition can be used? Its 2nd & 3rd parameters are type double which I'm not sure how it would go in ND's situation.
 
cameofx:
Sorry, didn't mean to nitpick... :) Btw do you think GlobalVariableSetOnCondition can be used? Its 2nd & 3rd parameters are type double which I'm not sure how it would go in ND's situation.
GV's are of type double only. Whether GlobalVariableSetOnConditio() can be used depends on what he is trying to achieve...
 
Yes. Oddly the example shows an integer input. Is it going to be typecasted? Not clear what the example suppose to demonstrate...
 
Nevermind. A flag, silly moi :) . 1 is true 0 is false or vv.