I’m hoping you can assist with an approach to the below problem.
I have two indicators, for ease of reference IndA and IndB:
- They are both computationally intensive.
- They are both have outputs that are used at a Strategy level
- I now require IndB to access one output from IndA.
- The output from IndA is updated at a specified frequency (e.g. on bar 200, 400, 600 etc.)
If my understanding is correct, I have several options:
- In IndB, add an instance of IndA.
IndB could access the required output from IndA. However, where a Strategy references both IndA and IndB, computation time will likely blow out as IndA will effectively calculate twice (once as IndA and again as a part of IndB). - Introduce a third umbrella indicator, IndC, and pass the outputs of IndA and IndB through to IndC.
IndB could access the required output from IndA. A Strategy would refer only to IndC. However, as IndA and IndB are separate and distinct it seems jamming them into a single indicator for convenience is a poor solution. - In IndA, use StreamWriter to “export” the required data. In IndB, use StreamReader to import the required data (I have found the NT examples but have not used the approach previously).
IndB could access the required output from IndA. Where a Strategy references both IndA and IndB, computation time should only increase by Stream write / read.As a secondary issue,- Should IndA write output values once at State.Terminated(?) and IndB read output values once at State.DataLoaded(?)? IndA would be required to effectively calculate twice, once to generate and write the output, then again as IndB reads the output.
- Should IndA write output values and IndB read output values as they are generated (e.g. on bar 200,400,600)? How could you ensure the IndA StreamWriter is closed and the latest values are present?
- A much better option I am not yet aware of.
I hope the above clearly states my predicament. Given options 1-3 each have significant drawbacks, I am hoping there is a forth option I am not aware of.
As always any insight, ideas or guidance would be appreciated.
Thanks
Shannon
Comment