As you can see, the idea is to trigger a long position on MainTicker every time Close of HelperTicker is under 20, and rely on "Foreign" function to do that.
Still, it doesn't work - anything wrong that can be spotted on the above? What happens, is Buy for MainTicker never gets set to 1, although Test column for HelperTicker is almost always 1.
Your code is wrong.
First there is no "Test" price field (in Foreign call)
Second, you are assigning PRICE to boolean (Buy variable). You should assign Boolean.
Just these two lines. You don't need anything else.
And as long as you only trade "MainTicker" you should run your backtest on that single ticker. Whenever formula references other tickers does not matter.
understand the above won't create an array (Test), rather than a simple boolean variable?
How would I create an array (thought something like "test = Close" does it) in one ticker's execution thread, that I could access in another ticker's execution thread?
Objective is to do some more complex computations within "GOOG" bars time-series and use the output (in form of array of values, one per bar) in "FB" ticker to issue orders.
Your above example is great as long as you rely on HelperTicker's O,H,L,C,V arrays alone (or simple derivatives).
Just Read the KB article. You can have as complex calculation as you can imagine. It does not matter. The method is the same. Read the KB. General pattern i
SetForeign("GOOG");
// ANY complex calculations you want (done on GOOG)
varA = ... whatever
varB = ...whatever
RestorePriceArrays();
// here you are back with FB data
Buy = ... any condition based on whatever you wish including varA and varB calculated
on GOOG
This is essentially what KB article explains. So just read it.