RIC crossovers

Hi there,

i’m attempting to use the show bar to alert me to a crossover when the RIC of a security crosses above its 200ema. I have successfully scripted the RIC and 200ema of the RIC into the watchlist but can’t get the correct data when i merge the two scripts into a showbar. any suggestions?

// calculate the 200 ema of the ric of security to spx 
r1 = RIC(DATESEL=Year To Date, ZEROBASED=True, INDEX=SPX:WI); 
m1 = MA(r1,BARS=200, STYLE=Exponential, CALC=Close); 

// ric of security to spx 
z1 =RIC(DATESEL=Year To Date, ZEROBASED=True, INDEX=SPX:WI);

z1 CrossesAbove m1

roughage

Hi Josh,

Your formula needs to be applied to the price chart, not the RIC tool (when a RIC function is applied to the RIC tool it calculates the RIC of the RIC). If you want the arrows just on the tool apply the Show Bar to the RIC using the following:

CLOSE() CrossesAbove MA(BARS=200, STYLE=Exponential, CALC=Close)

Also, the variable Z1 is the same as R1 so isn’t required.

Thank you Darren - I was able to get the result that I’m looking for in the showbar tool… having some fun I moved to the backtester and signal tester but the result isn’t what i was looking for as it pulled the 200ema of the issue and not the RIC.

Hi,

Because the Show Bar had been applied directly to the RIC tool, you did not need to set the RIC details in the script. The show bar was referencing that as the main data source already, so the script Darren gave you worked for that scenario.

Moving from a Show Bar applied to the RIC directly, to the Back Tester, the RIC needs to be setup in the script as the code being back tested is now the main data source.

For the Back Tester, your original script (with the duplicate z1 line removed) should produce the result you’re looking for:

// calculate the 200 ema of the ric of security to spx 
r1 = RIC(DATESEL=Year To Date, ZEROBASED=True, INDEX=SPX:WI); 
m1 = MA(r1,BARS=200, STYLE=Exponential, CALC=Close); 
r1 CrossesAbove m1