How do you trigger a buy/sell in the charted symbol from a condition of second ticker. For instance buy ABC if XYZ closes over XYZ's moving average.
If I use this on a chart of ABC:
def MA = SimpleMovingAvg();
def BUY = close("XYZ") > MA;
AddOrder(........);
that will give the condition BUY when XYZ closes greater than the moving average for ABC. Am I right? It would be nice if I could just tell it which stock to buy in the AddOrder() function but there's nowhere for it. Please forgive any syntax errors in my sample script, it's only meant to show my point.
If I use this on a chart of ABC:
def MA = SimpleMovingAvg();
def BUY = close("XYZ") > MA;
AddOrder(........);
that will give the condition BUY when XYZ closes greater than the moving average for ABC. Am I right? It would be nice if I could just tell it which stock to buy in the AddOrder() function but there's nowhere for it. Please forgive any syntax errors in my sample script, it's only meant to show my point.