3

Currently I have this:

datatable(SignalDataFrame,selection = 'single', options=list(dom='ft')) %>%
    #datatable(ResultDF, options=list(dom='ft')) %>%
      formatStyle(
        '200d MA',
        backgroundColor = styleInterval(0, c('#e6b8b7', '#d8e4bc'))
      ) %>%
      formatStyle(
        '50v200d MA',
        backgroundColor = styleInterval(0, c('#e6b8b7', '#d8e4bc'))
      ) %>%
      formatDate(c(3,5,6), "toLocaleDateString")
    })

As you see, style interval only formats values <0 in red and values >0 in green. I however want only to format cells in red respective in green for which their respective date is "younger" than 10 days.

For example column 200dMA (being column 2) should be only red if the value in this cell is <0 and the date in column 3 is younger than 10 days. And it should be green if the value is >0 and the date in column 3 is younger than 10 days.

How can I achieve that?

MichiZH
  • 5,587
  • 12
  • 41
  • 81

1 Answers1

3

You could add an extra column check to SignalDataFrame that checks columns 200d MA and 50v200d MA. Than, use it at formatStyle and hide it with visible.

user5029763
  • 1,903
  • 1
  • 15
  • 23