def advanceOptiuon(self):
        #every period calculates the appropriate statistic and prints
        #to the console and dataset
        data1 = self.sheetname.col_values(2)
        data1[:] = [item for item in data1 if item != '']
        dataframe1 = pd.DataFrame(data1)
        #print(dataframe1)
        dataframe2 = pd.DataFrame(data1[::99])
        #ensures objects flow in and out of R and Python without catastrophic failures
        pandas2ri.activate()
        #the final R code used, prior code can't be loaded with this functionality
        string = """statcalc <- function(x, size = 100){
                    x <- na.omit(x)
                    library(TTR)
                    library(stats)
                    xa <- ts(x)
                    arima <- arima(xa, c(0,0,0))
                    rsi <- RSI(xa, size - 1)[size]
                    list <- c(arima$coef, rsi)
                    return(as.matrix(list))
                    }
                    """
        statcalc = SignatureTranslatedAnonymousPackage(string, "statcalc")
        newlist = statcalc.statcalc(dataframe1, len(dataframe1))
        otherlist = statcalc.statcalc(dataframe2, len(dataframe2))
        winsandlosses = float(data1[99]) - float(data1[0])
        #the basic version of the algorithm, subject to change at a later date
        rsi = float(otherlist[1])
        if rsi > 80:
            rsi = 0
        if rsi < 35:
            rsi = 1
        gains = float(data1[99])
        arima = otherlist[0]
        arimaOverall = newlist[0]
        if gains - float(arima) > 0:
            topthird = 0
        else:
            topthird = 1
        if gains - float(arimaOverall) > 0:
            bottomthird = 0
        else:
            bottomthird = 1
        midthird = (newlist[1]) / 100
        arimaIndex = (float(2 / 3 * bottomthird) + float(1 / 3 * midthird) +
                      float(2 / 3 * topthird)) * 3 / 5

        if (rsi / 2 + arimaIndex / 2) > .5:
            rowtoinsert = [
                '', '', 'period gain: ',
                str(winsandlosses), 'it is recommended to: buy', 1,
                'rsi index is: ' + str(rsi),
                'arima index is: ' + str(arimaIndex)
            ]
        else:
            rowtoinsert = [
                '', '', 'period gain: ',
                str(winsandlosses), 'it is recommended to: sell', 0,
                'rsi index is: ' + str(rsi),
                'arima index is: ' + str(arimaIndex)
            ]
        self.sheetname.insert_row(rowtoinsert)