I'm working on a lab testing software - I'm at the backbone stage, and I'm just trying to test if the emergency stop will recognize a failure before it gets too far along.

Here is the code:

```
import sys

def main(argv):
    currentTempAverage = 0;
    testingPlaced = False
    typeOfTesting = False
    issue="False"
    class labTesting(object):

def __init__(self,currentCondition,emergencyStop=0):
    self.output = labLog()
Conditions = []
    self.status = "OPEN"
    self.beginningCondition = currentCondition
    self.EndingCondition = ""
    self.output.log("Testing opened")

if float(currentCondition) > float(self.beginningCondition*1.003):
    issue="True"

if (issue=="True") and float(currentCondition) < float(beginningCondition*1.002):
        self.output.log("YIKES!")
        self.status="CLOSED"

    if (emergencyStop):
        self.emergencyStop = currentCondition - emergencyStop
    self.output.log("stop loss") 

def close(self,currentCondition):
    if currentCondition > (self.beginningCondition * 1.012717049):
        self.status = "CLOSED"
        self.EndingCondition = currentCondition

def tick(self, currentCondition):

def showTesting(self):
    testingStatus = "Entry Condition: "+str(self.beginningCondition)

    self.output.log(testingStatus)

```

Basically, it's checking levels, and if the levels reach a certain point - issue=true, because it may become an issue.

If the levels become lower, it does the emergency stop. Depending how I do it, it throws errors.

```
Traceback (most recent call last):
  File "/home/DDesm/Desktop/w/labtest/testing.py", line 18, in tick
    if (issue=="True") and float(currentPrice) < float(entryPrice*1.002):

     UnboundLocalError: local variable 'issue' referenced before  assignment

```

Thanks!