I immediately apologize for the fact that many have already asked it.
I need your help, guys.
I have data.frame, which has a 'body' column. If body> 0, we compute the two columns on the same rules if the 'body' <0, then by different rules.
To bring the concept after a troubled part of my code:
if(data$body > 0){
data$shadow.up <- data$High - data$Close
data$shadow.down <- data$Open - data$Low
}else{
data$shadow.up <- data$High - data$Open
data$shadow.down <- data$Close - data$Low
}