
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm using this function courtesy of Hanover over at ForexFactory, I've adapted it slightly to work in my context.
I'd rather you'd give me an opinion on my question, though.
Well, I am using it. Paste it in an indicator, call the function with a website of your choice and let me know.
Well, I am using it. Paste it in an indicator, call the function with a website of your choice and let me know.
@whroeder1 While I hope you test it:
Forget the website part. It was not my question whether I can or can not get data from websites in an indicator. I just do it.
Please focus on the question part of my question:
Say indicator 1 does calculations resulting in a value and Indicator 2 needs those values.
In your opinion, is it better to have indicator 1 write these values into a .csv (I'd do that anyway to create charts in other software) and have indicator 2 read them (in the same time), if that is possible,
- or, have indicator 1 save them in an array and offer access to this array by indicator 2, if that is possible,
- or, as suggested by Emma here, share each new value by using a custom chart event?
I you do have an opinion on that out of your experience, I'd be interested, I don't want help with the code, as shown in previous threads, I always try to get around that myself as far as possible.
@whroeder1 While I hope you test it:
Forget the website part. It was not my question whether I can or can not get data from websites in an indicator. I just do it.
Please focus on the question part of my question:
Say indicator 1 does calculations resulting in a value and Indicator 2 needs those values.
In your opinion, is it better to have indicator 1 write these values into a .csv (I'd do that anyway to create charts in other software) and have indicator 2 read them (in the same time), if that is possible,
- or, have indicator 1 save them in an array and offer access to this array by indicator 2, if that is possible,
- or, as suggested by Emma here, share each new value by using a custom chart event?
I you do have an opinion on that out of your experience, I'd be interested, I don't want help with the code, as shown in previous threads, I always try to get around that myself as far as possible.
Being able to use WINNET call in an indicator doesn't mean it's a good idea to do it.
About your question :
I'm attempting to solve an issue but I'd like to have an opinion which solution is more efficient/appropriate in the MQL4 way of thinking.
There is no generic answer, it depends of your specific case. File can be fine, ChartEvent too, or any other way. In summary, there is no best way.
- or, as suggested by Emma here, share each new value by using a custom chart event?
Well, if you want efficient code with asynchronous operation and the fastest possible response time then you'd run a worker script (do not use an indicator to process web requests) and an EA on the same chart. The worker script would perform the web request (asynchronous work), parse and/or re-serialize the relevant data and send it to the EA via EventChartCustom's "sparam" for large data-set or use the lparam/dparam if all you need to send is a simple value.
I think it would make a lot more since if you saw it as an example.
Example script:
Example EA (or indicator):
Compile and run both on the same chart to get a better understanding of how it works.
Well, if you want efficient code with asynchronous operation and the fastest possible response time then you'd run a worker script (do not use an indicator to process web requests) and an EA on the same chart. The worker script would perform the web request (asynchronous work), parse and/or re-serialize the relevant data and send it to the EA via EventChartCustom's "sparam" for large data-set or use the lparam/dparam if all you need to send is a simple value.
I think it would make a lot more since if you saw it as an example.
Example script:
Example EA (or indicator):
Compile and run both on the same chart to get a better understanding of how it works.
Thanks so much, Emma!
I haven't had the chance to compile and understand the code but will ASAP and reply here. Thank you!