How to plot difference (spread) between two symbols

0 votes
asked May 27, 2017 in AmiBroker by angad
edited May 27, 2017 by admin
i need to plot this in candlestick and be able to run it with indicators.  how do it do it ?

let Pa = the price of scrip A on specified date which i will enter manually.

let Pb = the price of scrip B on a specified date which i will enter manually.

I need to plot the formula

(Close A - Pa) - (Close B - Pb)

please let me know

2 Answers

0 votes
answered May 27, 2017 by admin (9,260 points)
 
Best answer

It is explained in the Knowledge Base at:

http://www.amibroker.com/kb/2007/03/26/how-to-chart-spreads/

Example formula:

CloseA = Foreign("SymbolA", "C" );
CloseB = Foreign("SymbolB", "C" );

Pa =  .. your price A
Pb = ..your price B

result = (CloseA - Pa ) - (CloseB - Pb)

Plot( result, "Your indicator", colorRed );

0 votes
answered May 27, 2017 by fxshrat (1,200 points)
...