# Indicators wpr = WilliamsPercentRange( period: 6 ) macd = MACD( applyTo: close, fastPeriod: 3, slowPeriod: 16 ) macdSignal = MACDSignal( applyTo: close, signalPeriod: 4, fastPeriod: 3, slowPeriod: 16 ) stdDev = StdDev( applyTo: close, period: 21 ) # Rules/triggers longEntryRule = wpr > -43 longEntryRule2 = CrossesUpwards( value: macd, crosses: macdSignal ) longEntryRule3 = ChangesDirectionUpwards(stdDev) shortEntryRule = wpr < -57 shortEntryRule2 = CrossesDownwards( value: macd, crosses: macdSignal ) shortEntryRule3 = ChangesDirectionUpwards(stdDev) longExitRule = ChangesDirectionUpwards(volume) shortExitRule = ChangesDirectionUpwards(volume) # Signals enter long when longEntryRule and longEntryRule2 and longEntryRule3 enter short when shortEntryRule and shortEntryRule2 and shortEntryRule3 exit long when longExitRule exit short when shortExitRule