Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
AVG Cost

I am new to this coding thing and am having a hard time with a simple first program.

I was wondering if someone could show me how to write a simple trade program based on the cost average.

For instance:
AVG Cost of 6 XYZ shares is 6.00per share.

If XYZ is 10% less than AVG Cost buy one share. If XYZ is 10% higher than AVG cost sell one share.

Also can this update every couple seconds or can this only be done once a day?

Thanks for any help.