請問要如何解決下列分母為0的方式?
Inputs: FastLength_MACD(8), SlowLength_MACD(13), SignalLength_MACD(5);
Inputs: KDJLength(8), MA_Length(3);
Inputs: RSILength_short(5), RSILength_long(13);
Inputs: LWRLength(13), LWR2Length(3);
Inputs: MA1(3), MA2(5), MA3(8), MA4(13);
Inputs: MTMLength(12);
Vars: DIFF_MACD(0), DEA_MACD(0), MACD_Cross(False);
Vars: RSV1(0),K(0), D(0), KDJ_Cross(False);
Vars: Highest_high(0), Lowest_low(0), RSI_short(0), RSI_long(0), RSI_Cross(False);
Vars: LWR1(0), LWR2(0), LWR_Cross(False);
Vars: BBI(0), BBI_Cross(False);
Vars: MTM(0), MMS(0), MMM(0), MTM_Cross(False);
DIFF_MACD = XAverage(Close, FastLength_MACD) - XAverage(Close, SlowLength_MACD);
DEA_MACD = XAverage(DIFF_MACD, SignalLength_MACD);
if DIFF_MACD > DEA_MACD then
MACD_Cross = True
else
MACD_Cross = False;
RSV1 = (Close - Lowest(Low, KDJLength)) / (Highest(High, KDJLength) - Lowest(Low, KDJLength)) * 100;
K = XAverage(RSV1, MA_Length);
D = XAverage(K, MA_Length);
if K > D then
KDJ_Cross = True
else
KDJ_Cross = False;
RSI_short = RSI(Close, RSILength_short);
RSI_long = RSI(Close, RSILength_long);
if RSI_short > RSI_long then
RSI_Cross = True
else
RSI_Cross = False;
LWR1 = XAverage((Highest_high - Close) / (Highest_high - Lowest_low) * 100, LWRLength);
LWR2 = XAverage(LWR1, LWR2Length);
if LWR1 > LWR2 then
LWR_Cross = True
else
LWR_Cross = False;
BBI = (XAverage(Close, MA1) + XAverage(Close, MA2) + XAverage(Close, MA3) + XAverage(Close, MA4)) / 4;
if Close > BBI then
BBI_Cross = True
else
BBI_Cross = False;
MTM = Close - Close[1];
MMS = 100 * XAverage(XAverage(MTM, 5), 3) / XAverage(XAverage(AbsValue(MTM), 5), 3);
MMM = 100 * XAverage(XAverage(MTM, 13), 8) / XAverage(XAverage(AbsValue(MTM), 13), 8);
if MMS > MMM then
MTM_Cross = True
else
MTM_Cross = False;
Plot1(MACD_Cross, "MACD_Cross");
Plot2(KDJ_Cross, "KDJ_Cross");
Plot3(RSI_Cross, "RSI_Cross");
Plot4(LWR_Cross, "LWR_Cross");
Plot5(BBI_Cross, "BBI_Cross");
Plot6(MTM_Cross, "MTM_Cross");
 
 
             
        
        .jpg?width=50&crop=0,0,50,50) 
         
         
         
     
     分類
    分類
 
            
2 評論