StockFetcher Forums · General Discussion · Position Sizing Revisited<< >>Post Follow-up
davesaint86
725 posts
msg #158434
Ignore davesaint86
modified
1/22/2022 4:00:33 PM

https://www.udemy.com/course/learn-how-to-trade-the-deep-dip-buy-stock-trading-strategy/#reviews
https://www.youtube.com/channel/UCviK0XeiDS0l1deHtEVmrKw

I'm currently taking the above trading course above via Udemy. So far it's a great course. One of the better ones I've taken. I remember Kevin developed a great Position Sizing filter. Below is that filter with some modifications based on what I'm learning in the course. I added a 2.0 ATR emergency stop loss, 1.5 ATR trailing loss and .45 daily profit targets that are discussed in the course. The instructor also has a YouTube channel that I listed above.

Fetcher[apply to symlist(spy,sso,ddm,qqq,qld,uwm,amzn,dis,googl,aapl,fb,gs,ma)

draw keltner band(20,1.0)
draw keltner band(20,2.0)
draw keltner band(20,3.0)

draw ema(5)
draw ma(50)
draw ma(200)
draw ma(250)

draw rsi(14)
draw rsi(14) line at 50

draw rsi(14) line at 30
draw rsi(14) line at 70

draw macd(12,26,9)

and draw Slow Stochastic(14,3) Fast %K line at 20.00 and draw Slow Stochastic(14,3) Fast %K line at 80.00 and draw Slow Stochastic(14,3) Fast %K line at 50.00
and draw Slow Stochastic(14,3) line at 50

/*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{STOPLOSS2ATR, LIMITENTRY - 2ATR}

/* Trailing Stop Loss - Adjusted Based On Price Movement*/
SET{1_5ATR, 1.5 * ATR(20)}
SET{TRAILSTOP1.5ATR, CLOSE + 1_5ATR}
draw price line at TRAILSTOP1.5ATR on plot price

/* Profit Target*/
SET{.45ATR, .45 * ATR(20)}
SET{PROFITTARGET.45, CLOSE + .45ATR}
draw price line at PROFITTARGET.45 on plot price

/*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 SEPARATOR
ADD COLUMN RSI(14)
ADD COLUMN MA(200)
ADD COLUMN MA(250)
ADD COLUMN ATR(20) {ATR(20)}

add column average day range (20){ADR%}
ADD COLUMN SEPARATOR
ADD COLUMN SHARESTOBUY {SHARES TO BUY}

ADD COLUMN LIMITENTRY {LIMIT ENTRY}

ADD COLUMN REVERSERSI(2,90) {PROFIT TARGET}
ADD COLUMN SEPARATOR
ADD COLUMN STOPLOSS2ATR {ESL-2.0_ATR}
Add COLUMN TRAILSTOP1.5ATR {TS-1.5_ATR}

ADD COLUMN PROFITTARGET.45 {PT-.45_ATR}
ADD COLUMN SEPARATOR
ADD COLUMN R_R {REWARD-TO-RISK}

ADD COLUMN POSITIONAMT {POSITION SIZE IN DOLLARS}

ADD COLUMN POSITIONPCT {PERCENT OF TRADING EQUITY}
ADD COLUMN SEPARATOR

ADD COLUMN ROC(252,1) {12 mth %}
ADD COLUMN ROC(126,1) {6 mth %}
ADD COLUMN ROC(63,1) {3 mth %}
ADD COLUMN ROC(21,1) {1 mth %}

SORT ON COLUMN 12 DESCENDING

DRAW PRICE LINE AT LIMITENTRY ON PLOT PRICE

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


CHART-TIME IS 160 days
]



davesaint86
725 posts
msg #158435
Ignore davesaint86
1/22/2022 4:02:04 PM

By the way, is there a way to clean up the Keltner Channels? Colors?

redversa721
157 posts
msg #158437
Ignore redversa721
1/22/2022 10:55:32 PM

Thank you for this. Looks interesting. and beautiful code with great comments in there.

davesaint86
725 posts
msg #158440
Ignore davesaint86
modified
1/23/2022 1:03:02 PM

I created the template in TradingView

https://www.tradingview.com/chart/jBRippiR/

Most of it is Kevin's code.

His strategy uses 3-intra Proft Targets that are based on .45 ATR increments that stair-step on each other. So TP #1 = .45 ATR
TP#2 = .90 ATR
TP#3 = 1.35 ATR

The target profits are reset each day based on the closing price if you still have shares remaining.

davesaint86
725 posts
msg #158441
Ignore davesaint86
modified
1/23/2022 1:18:03 PM

I added the two additional intra-day target profits.

Fetcher[apply to symlist(spy,sso,ddm,qqq,qld,uwm,amzn,dis,googl,aapl,fb,gs,ma)

draw keltner band(20,1.0)
draw keltner band(20,2.0)
draw keltner band(20,3.0)

draw ema(5)
draw ma(50)
draw ma(200)
draw ma(250)

draw rsi(14)
draw rsi(14) line at 50

draw rsi(14) line at 30
draw rsi(14) line at 70

draw macd(12,26,9)

and draw Slow Stochastic(14,3) Fast %K line at 20.00 and draw Slow Stochastic(14,3) Fast %K line at 80.00 and draw Slow Stochastic(14,3) Fast %K line at 50.00
and draw Slow Stochastic(14,3) line at 50

/*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{STOPLOSS2ATR, LIMITENTRY - 2ATR}

/* Trailing Stop Loss - Adjusted Based On Price Movement*/
SET{1_5ATR, 1.5 * ATR(20)}
SET{TRAILSTOP1.5ATR, CLOSE + 1_5ATR}
draw price line at TRAILSTOP1.5ATR on plot price

/* Profit Target #1*/
SET{.45ATR_1, .45 * ATR(20)}
SET{PROFITTARGET.45_1, CLOSE + .45ATR_1}
draw price line at PROFITTARGET.45_1 on plot price

/* Profit Target #2*/
SET{.90ATR_2, .90 * ATR(20)}
SET{PROFITTARGET.90_2, CLOSE + .90ATR_2}
draw price line at PROFITTARGET.90_2 on plot price

/* Profit Target #3*/
SET{1.35ATR_3, 1.35 * ATR(20)}
SET{PROFITTARGET1.35_3, CLOSE + 1.35ATR_3}
draw price line at PROFITTARGET1.35_3 on plot price

/*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 SEPARATOR
ADD COLUMN RSI(14)
ADD COLUMN MA(200)
ADD COLUMN MA(250)
ADD COLUMN ATR(20) {ATR(20)}

add column average day range (20){ADR%}
ADD COLUMN SEPARATOR
ADD COLUMN SHARESTOBUY {SHARES TO BUY}

ADD COLUMN LIMITENTRY {LIMIT ENTRY}

ADD COLUMN REVERSERSI(2,90) {PROFIT TARGET}
ADD COLUMN SEPARATOR
ADD COLUMN STOPLOSS2ATR {ESL-2.0_ATR}
Add COLUMN TRAILSTOP1.5ATR {TS-1.5_ATR}

ADD COLUMN PROFITTARGET.45_1 {PT-1}
ADD COLUMN PROFITTARGET.90_2 {PT-2}
ADD COLUMN PROFITTARGET1.35_3 {PT-3}
ADD COLUMN SEPARATOR
ADD COLUMN R_R {REWARD-TO-RISK}

ADD COLUMN POSITIONAMT {POSITION SIZE IN DOLLARS}

ADD COLUMN POSITIONPCT {PERCENT OF TRADING EQUITY}
ADD COLUMN SEPARATOR

ADD COLUMN ROC(252,1) {12 mth %}
ADD COLUMN ROC(126,1) {6 mth %}
ADD COLUMN ROC(63,1) {3 mth %}
ADD COLUMN ROC(21,1) {1 mth %}

SORT ON COLUMN 12 DESCENDING

DRAW PRICE LINE AT LIMITENTRY ON PLOT PRICE

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


CHART-TIME IS 160 days
]

davesaint86
725 posts
msg #158442
Ignore davesaint86
modified
1/23/2022 1:18:28 PM

Duplicate

davesaint86
725 posts
msg #158443
Ignore davesaint86
modified
1/23/2022 1:18:54 PM

Duplicate

StockFetcher Forums · General Discussion · Position Sizing Revisited<< >>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.