Main() is only executed once. Did zooming to the chart bar-by-bar show HoldTrend still at zero?

Add watch("HoldTrend=", HoldTrend, NumOpenLong) and see if the issue is with the variable or plotting.