感謝群裡的凌波大大協助提點,以下就將當時寫的內容作一紀錄。
variables : vMP(0), vBar(0); vMP = i_marketposition; if vMP <> 0 then vBar = vBar[1] + 1; If (vMP = 1 and (vMP[1] = -1 or vMP[1] = 0)) or (vMP = -1 and (vMP[1] = 1 or vMP[1] = 0)) or (vMP = 0 and (vMP[1] = -1 or vMP[1] = 1)) then vBar = 0;