Announcement

Collapse
No announcement yet.

2 data sources...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2 data sources...

    I have a study that I've created that uses multiple data sources (let's say ES, NQ and YM) and creates a value between 0 and 1 based on these data sources. For simplicity let's say that it's the average RSI of the 3.

    This works well and the histogram is drawn but when I reload it the values are all slightly different. I think that this could be a timing issue with the close of 1 bar on the base symbol (the ES) before the close of the other bars (on the NQ and YM).

    Does this sound logical? If so, is there any way you can suggest to resolve this problem?

    Thanks,
    Guy
    Standing on the shoulders of giants.

  • #2
    You are correct..

    I have done things like this in the past and it is a timing issue..

    The EFS you are running is on symbol A (lets say). Well symbol A "ticks" differently than symbol B.

    So the calculations of your EFS (on symbol A) could miss ticks generated in symbol B - thus the errors are created..

    The only solution that I know of is to .....

    1. wait for the new bar to finish forming then, read the data from the previous bar (for both symbols).

    or...

    2. Use Global Variables for symbol B to keep it currently updated..
    but this will present problems for your historical code (histogram).


    with the solution #2, you'll probably have to create a "two piece" code....

    for historical data, use the code the way it is currently (to pull data from the other chart)

    for current intraday data, use the global variable for the caluclations..

    ie...

    if (getCurrentBarIndex() == 0) {
    .. use global variables
    } else {
    .. use your current historical data routine.
    }

    Hope this helps..

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Many thanks for your reply Brad.

      One thing which confuses me is how you manage to asign the glboal values of symbol B.

      If we are looking at the 1min ES chart and our other symbol of interest is the 1min NQ: Am I correct in saying that the main() function is only called each time a new "tick" comes in for the ES? So each time the main() function is called we use:

      vValue = getValue("Close", 0, -(nLength+1), "NQ #F");

      to get the current value for the NQ.

      Now say there is no tick for the ES from 11:34:50 to 11:35:10 but there is a tick for the NQ at 11:34:58. Our global variable won't be filled with the NQ's value because main() was never called when the new NQ tick came in.

      Many thanks for taking your time to reply to this thread.
      Regards,
      Guy
      Standing on the shoulders of giants.

      Comment

      Working...
      X