This script takes the lowest of the last 3 bars on your current time frame and sets that as your stop loss. Then it will takes 2 inputs. Trade Amount, which is how much you're willing to spend on the trade. And Risk Amount, which is the max you're willing to lose one the trade. Then it will calculate how many shares you should buy based the stop loss previously calculated, trade amount, and risk amount.