# Put any initialization logic here.  The context object will be passed to
# the other methods in your algorithm.
def initialize(context):
    context.stocks = symbols('SPY')

# Will be called on every trade event for the securities you specify.
def handle_data(context, data):
    for stock in context.stocks:
        ma1 = data[stock].mavg(43)
        ma2 = data[stock].mavg(180)

        # price = data[stock].price

        if ma1 > ma2:
            order_target_percent(stock, 0.99)

        elif ma1 < ma2:
            order_target_percent(stock, 0.00)

@@ -1,118 +1,4 @@
-# Put any initialization logic here.  The context object will be passed to%0A# the other methods in your algorithm.%0A
 def 
@@ -35,29 +35,21 @@
 xt.s
-tocks = symbols('SPY'
+py = sid(8554
 )%0A%0A#
@@ -157,76 +157,41 @@
     
-for stock in context.stocks:%0A        ma1 = data%5Bstock%5D.mavg(43)%0A    
+ma1 = data%5Bcontext.spy%5D.mavg(55)%0A
     
@@ -205,67 +205,32 @@
 ata%5B
-stock
+context.spy
 %5D.mavg(
-18
+20
 0)%0A%0A
-        # price = data%5Bstock%5D.price%0A%0A    
     
@@ -239,28 +239,24 @@
  ma1 %3E ma2:%0A
-    
         orde
@@ -276,26 +276,26 @@
 ent(
-stock, 0.99)%0A%0A    
+context.spy, 1.0)%0A
     
@@ -306,28 +306,24 @@
  ma1 %3C ma2:%0A
-    
         orde
@@ -343,17 +343,191 @@
 ent(
-stock, 0.00)%0A
+context.spy, 0.00)%0A%0A%22%22%22%0Asome other numbers to try%0A33, 205%0A55, 205%0A55, 195%0A60, 450%0A75, 425 //This is the highest result I have been able to find%0A75, 430%0A75, 440%0A75, 450%0A75, 455%0A75, 465%0A%22%22%22

Check it out!