# Define condition (a) - Current closing price (c) greater than 0
def conditionA = close > 0;
# Define condition (b) - Current closing price (c) greater than (h + l) / 2
def conditionB = close > ((high + low) / 2);
plot scanCondition = volume > 2 * avgv20 AND cOverC1Ratio > calculatedValue AND product > 1000000 AND countLessThanAvgc20 AND (conditionA or conditionB);
I use chatGPT to translate the TC2000 script to TOS if anyone finds it helpful
def avgv20 = Average(volume, 20);
# Calculate the 20-day average of the high/low ratio (h/l)
def hlRatioAvg20 = Average(high / low, 20);
# Calculate the value you want to compare with (including additional calculations)
def calculatedValue = 1 + 2 * (hlRatioAvg20 - 1);
# Calculate the current c/c1 ratio
def cOverC1Ratio = close / close[1];
# Calculate the product of the current closing price (c) and the 20-day average volume (avgv20)
def product = close * Average(volume, 20);
# Calculate the number of times in the last 40 days when c is less than avgc20
def countLessThanAvgc20 = Sum(close < Average(close, 20), 40);
# Define condition (a) - Current closing price (c) greater than 0
def conditionA = close > 0;
# Define condition (b) - Current closing price (c) greater than (h + l) / 2
def conditionB = close > ((high + low) / 2);
plot scanCondition = volume > 2 * avgv20 AND cOverC1Ratio > calculatedValue AND product > 1000000 AND countLessThanAvgc20 AND (conditionA or conditionB);