Would anyone know how to plot the formula for the spread between two companies using RSI within Amibroker? Below is how I've attempted the formula. I'm attempting to compare the RSI of the Dow vs other stocks. The R2 line of the formula below appears incorrect. _SECTION_BEGIN("RSISpread"); R1 = RSI(14); // company RSI R2 = Foreign( "DJ", "R1 "); // Foreign stock RSI R3 = R1 - R2; _SECTION_END();
this might do.. _SECTION_BEGIN("rsi"); Ticker= ParamStr("Short ticker", "?");//short stock tickersc=Foreign( ticker, "C");//Short stock ///////////////////////////////////// ticker2=C;//long stock ///////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// spreadc=C/(tickersc); ////////////////cci////////////////// N=Param("N",14,2,34,1); Plot(RSIa(spreadc,N),"RSI",5,5); _SECTION_END();
_SECTION_BEGIN("RSISpread"); dj=foreign("DJ","C"); R1 = RSI(14); // company RSI R2 = RSIa(dj,14) R3 = R1 - R2; _SECTION_END(); To see it: plot(R3,"R1-R2 Spread",colorblack,1,1);
Thankyou auric and empee. I noticed after my first posting that foreign was limited to datafields of O,C,H,L,V and OI and I couldn't get my head around on how to use it otherwise. I have 2 of Bandy's books on using AB formulas but still couldn't suss it out. Thanks again.
Hi, could anyone have the Amibroker formula for candlestick spread between two stocks? I have only spread with plotting just line of EOD prices, but I need candlestick chart of OHLC spread prices. Thanks.