How do I put an SMA on the Spread Differential to plot/code together for TS?

clbradley17

Junior member
Messages
25
Likes
0
How can I put a simple moving average on a spread differential indicator on the same plot underneath price, so the SMA isn't the SMA of the price, but of the spread differential indicator? The SpreadDif and SMA have to be in the same code too, don't they? This is the code for TS's Spread Differential:

inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;

Plot1( DataSeries1 - DataSeries2, "SprdDiff" ) ;

and for the Mov Avg 1 line:

inputs: Price( Close ), Length( 9 ), Displace( 0 ) ;
variables: Avg( 0 ) ;

Avg = AverageFC( Price, Length ) ;

if Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin
Plot1[Displace]( Avg, "Avg" ) ;
end;

Just not sure how to paste these together to put them in the same code. Thanks for any help.
 
How can I put a simple moving average on a spread differential indicator on the same plot underneath price, so the SMA isn't the SMA of the price, but of the spread differential indicator? The SpreadDif and SMA have to be in the same code too, don't they? This is the code for TS's Spread Differential:

inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;

Plot1( DataSeries1 - DataSeries2, "SprdDiff" ) ;

and for the Mov Avg 1 line:

inputs: Price( Close ), Length( 9 ), Displace( 0 ) ;
variables: Avg( 0 ) ;

Avg = AverageFC( Price, Length ) ;

if Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin
Plot1[Displace]( Avg, "Avg" ) ;
end;

Just not sure how to paste these together to put them in the same code. Thanks for any help.
I have given you an answer in the other thread. You don't need to post the same message twice in different threads.

Charlton
 
Top