def HMA = MovingAverage(AverageType.HULL, close, 20); def HMA_Sig1 = (HMA > HMA[1] and HMA[1] <= HMA[2]); def HMA_Sig2 = (HMA > HMA[1]); def RMI70 = RelativeMomentumIndex()."RMI" >= 70; def KCUB_Sig = (close > KeltnerChannels()."Upper_Band"); def KCLB_Sig = (low < KeltnerChannels()."Lower_Band"); def ADX30 = (ADX() >=30); #Time Conditions (Buy Open/Sell Close) def tW1 = SecondsFromTime(925) >= 0 and SecondsFromTime(930) <= 1800; def Buy_1 = KCUB_Sig and HMA_Sig2 and RMI70 and tW1; def Buy11 = Buy_1[1] crosses above 0; #========================== def RMIx30 = RelativeMomentumIndex()."RMI" crosses above 30; def HMApos = HMA_Sig1[1] crosses above 0 or HMA_Sig1 crosses above 0; def RMIpos = RMIx30[1] crosses above 0 or RMIx30 crosses above 0; #Time Conditions (Buy Open/Sell Close) def tW3 = SecondsFromTime(925) >= 0 and SecondsFromTime(930) <= 7200; def Buy_2 = HMA_Sig1 and KCLB_Sig and ADX30 and tW3; def Buy22 = Buy_2[1] crosses above 0; def Buy_3 = HMApos and (RMIpos) and tW3; def Buy33 = Buy_3[1] crosses above 0; def Buy = Buy11 or Buy22 or Buy33; #============================= AddOrder(OrderType.BUY_TO_OPEN, Buy, name = "BUY", price = close, arrowcolor = Color.VIOLET); def ADXAvg = Average(ADX()[1], 3); def ADX_Sig = (ADX() >= ADXAvg) and (ADX() > 10); def TTMpos = TTM_Squeeze()."Histogram" is greater than or equal to TTM_Squeeze()."Histogram" from 1 bars ago; def TTMneg = (TTM_Squeeze()."Histogram" is less than or equal to TTM_Squeeze()."Histogram" from 1 bars ago) and TTM_Squeeze()."Histogram" < 0; #Time Conditions (Buy Open/Sell Close) def tW2 = SecondsFromTime(930) >= 22475 and SecondsFromTime(930) <= 22500; def tW4 = SecondsFromTime(930) >= 0 and SecondsFromTime(930) <= 23400; def HMA_Sig4 = (HMA < HMA[1] and HMA[1] >= HMA[2]); def Sell = (HMA_Sig4 and tW4) or tW2 crosses above 0; AddOrder(OrderType.SELL_TO_CLOSE, Sell, name = "SELL", arrowcolor = Color.WHITE);