StockFetcher Forums · Filter Exchange · Van Tharp Position Sizing - Need Help to Correct This Filter<< >>Post Follow-up
davesaint86
725 posts
msg #133821
Ignore davesaint86
1/19/2017 10:55:18 AM

I took the code from one of Kevin's filters. I want the filter to determine based on the 100k Account size to split the equity per position based on risk. Based on my thoughts the three positions may not add up to the full 100K but should definitely not be over the amount. So what I'm really looking for is I want to be able say up to 10 stocks based on a 100k account size and I want to see the recommended equity position in dollars and in %. Thanks.

Fetcher[
apply to symlist(iwm,efa,spy)

/*DETERMINE THE MAXIMUM AMOUNT YOU ARE WILLING TO LOSE*/
SET{ACCOUNTSIZE,100000}
SET{RISKLEVEL, ACCOUNTSIZE*0.010}

/*DETERMINE LIMIT ENTRY POINT*/
SET{LIMITENTRY, MIN(CLOSE, REVERSERSI(2,5))}

/* VAN THARP POSITION SIZING - SET THE STOP LOSS AND SHARE SIZE BASED ON LIMIT ENTRY AND AMOUNT WILLING TO LOSE*/
SET{2ATR, 2 * ATR(20)}
SET{STOPLOSS, LIMITENTRY - 2ATR}

/*DETERMINE THE NUMBER OF SHARES TO BE PURCHASED*/
SET{SHARESTOBUY1, RISKLEVEL/2ATR}
SET{SHARESTOBUY, ROUND(SHARESTOBUY1, 0)}

/*TOTAL AMOUNT OF EQUITY USED IN THIS TRADE*/
SET{POSITIONAMT, LIMITENTRY * SHARESTOBUY}

/*PERCENT OF TRADING CAPITAL USED IN THIS TRADE*/
SET{POSITIONPCT1, POSITIONAMT / ACCOUNTSIZE}
SET{POSITIONPCT, POSITIONPCT1 * 100}

/*DETERMINE THE REWARD-TO-RISK RATIO BASED ON THE PROFIT TARGET AT RSI(2) = 90*/
SET{REWARD1, REVERSERSI(2,90) - LIMITENTRY}
SET{REWARD, REWARD1 * SHARESTOBUY}
SET{R_R, REWARD / RISKLEVEL}

/*SET THE CRITERIA NECESSARY TO TRIGGER A TRADE*/


ADD COLUMN RSI(2)
ADD COLUMN ATR(20) {ATR(20)}
ADD COLUMN SEPARATOR
ADD COLUMN SHARESTOBUY {SHARES TO BUY}
ADD COLUMN LIMITENTRY {LIMIT ENTRY}
ADD COLUMN REVERSERSI(2,90) {PROFIT TARGET}
ADD COLUMN STOPLOSS {STOP LOSS}
ADD COLUMN R_R {REWARD-TO-RISK}
ADD COLUMN POSITIONAMT {POSITION SIZE IN DOLLARS}
ADD COLUMN POSITIONPCT {PERCENT OF TRADING EQUITY}

SORT ON COLUMN 12 DESCENDING

DRAW PRICE LINE AT LIMITENTRY ON PLOT PRICE

DRAW PRICE LINE AT REVERSERSI(2,90) ON PLOT PRICE
DRAW RSI(2) LINE AT 5
DRAW RSI(2) LINE AT 90

CHART-TIME IS 3 MONTHS
]




Kevin_in_GA
4,599 posts
msg #133826
Ignore Kevin_in_GA
1/19/2017 12:44:56 PM

That's not how it works - the code is driven by the maximum acceptable loss you will take before closing a trade. The ATR(20) of each stock or ETF sets the number of shares you buy, not your account size.

StockFetcher Forums · Filter Exchange · Van Tharp Position Sizing - Need Help to Correct This Filter<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.