I am moving over from Quantopian and am having some issues replicating my code so I want to see if anyone can help me clarify things. The goal of this code is to buy something that fits these crietria

current price > SMA30

:100 PricetoEBITDA -> :50 of ROIC from this -> :15 BookValuePerShare from this

Goal would be to then liqiudiate any stock whenever it doesn't fit any of these criteria and purchase whichever one takes its place. My issues are such:

Do I have the current price > SMA30 set-up correctly? I couldn't find a way to reference current price, so I thought SMA1 would do the trick. 

Am I only trading on the :15 BookValuePerShare that I have narrowed it down to? If so, I don't understand why I keep having margin issues when I have it set to 0.04 per security. .04 x 15 = 0,6 when leverage is 1.0, so I don't see why this is happening?