Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Min and Max notionals not working

Hi guys, take a look at my source -

I created my orders based on and/or scenarios for vwaps/mavg's

however - i am blowing thru my max and min notionals which i have set very tight at 500 shares max and 500 min - and the system suddenly blows me out 2500 shares long or 2800 shares short.

If i remove the "or" operator and change it to an "and" operator - the min/max notionals work correctly.

I'd love some insight. yes -very green with programming.

2 responses

Hey Andrew,

The precedence rules for boolean operators require parens for the logic you want - always require the notional guard. I added them, and moved some logging around, and added a record of the position size so you can see the behavior more clearly. FYI, zoom in to see the exact position size, the charts do some averaging when zoomed out.

thanks,
fawce

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

John thank you very much - that makes a lot more sense now!