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

Second day trying to learn Python. Just trying to copy the Sample Algorithm for a Basic Strategy 1. Why am I getting an invalid syntax on line 27(bar_count=5)? Any help is much appreciated.

4 responses

try bar_count = 5

with a space before and after the =

if not we may need to see lines 26,27,28 from your code

space before and after did not work.
lines 24-30:
price_history = data.history(
context.security,
fields='price'
bar_count = 5
frequency = '1d')

Try putting a "," after the line fields='price' - and also after bar_count = 5.
These are parameters to a function and need to be separated by a comma:

price_history = data.history(
context.security,
fields='price',
bar_count = 5,
frequency = '1d')