StockFetcher Forums · View by Author: (499 messages)  [ Display By: Date / Subject ]<< 1 ... 2 3 4 5 6 ... 50 >> 
Filter Exchange · Simplified Supertrend Swingtrade
msg #159138
5/29/2022 5:50:27 PM

During the non-stop bull market of the past few years I would sometimes use Mobius' Supertrend indicator and scanner on ThinkOrSwim for entries and exits. As with all strategies, you have to adapt to changing market realities. I adapted the script for the current correction/bear scenario we are in.

I enter at the close and, this is very important, exit at the close of the next tick, full stop. It doesn't matter if the next tick is long or short, I exit. We are not in a trending environment and as such I'm not using this filter as a true Supertrend indicator. These are very quick trades, usually under a week

/* Adapted from Mobius ToS Supertrend: */
/* Enter at close. Exit on next tick, whether tick is long or short */
set{uptrend1,high + low}
set{uptrend2,uptrend1 / 2}
set{uptrend,uptrend2 + ATR(4)}
set{downtrend,uptrend2 - ATR(4)}

set{long,count(close > uptrend 1 day ago,1)}
set{short,count(close < downtrend 1 day ago,1)}

long > 0
short > -1

days(long 1 day ago equals 1,90) > days(short 1 day ago equals 1,90)
close > wma(150) for last 100 days

add column days(long 1 day ago equals 1,90)
add column days(short 1 day ago equals 1,90)

set{1up,uptrend 1 day ago}
set{1down,downtrend 1 day ago}

draw 1up on plot price
draw 1down on plot price

Filter Exchange · Bottom Filter
msg #159054
5/11/2022 9:59:20 AM

The problem with writing this in SF is the lack of looping capability. I took a stab at it and the results are not correct. Still, I'm posting it here in case someone wants to debug, improve, or point out where my logic is wrong.



set{PB1a,a1 - a2}
set{PB1b,PB1a * close}
set{PB1b_1,PB1a * close 1 day ago}
set{PB1b_2,PB1a * close 2 days ago}

set{PB2a,1 - a1}
set{PB2b,a2 * PB2a}
set{PB2c,1 - a2}
set{PB2d,a1 * PB2c}
set{PB2e,PB2b - PB2d}
set{PB2f,PB2e * close 1 day ago}
set{PB2f_2,PB2e * close 2 days ago}
set{PB2f_3,PB2e * close 3 days ago}

set{PBt,PB1b + PB2f}
set{PBt1,PB1b_1 + PB2f_2}
set{PBt2,PB1b_2 + PB2f_3}

set{PB3a,PB2a + PB2c}
set{PB3b,PB3a * PBt1}

set{PB4a,PB2a * PB2c}
set{PB4b,PB4a * PBt2}

set{PBsum1,PBt + PB3b}
set{PB,PBsum1 - PB4b}

set{RMSa1,PB * PB}
set{RMSa,RMSa1 + 50}

set{RMSplus1,RMSa / 50}
set{RMSminus,1 - RMSplus}

draw PB
draw RMSplus on plot PB
draw RMSminus on plot PB

add column separator
add column PB
add column RMSplus
add column RMSminus

chart-time 1 year

Filter Exchange · Moving Average of Moving Average
msg #158980
4/16/2022 9:08:47 PM

Welcome to the StockFetcher community, bconnell!

Very interesting results on the ema(5), cma(ema(5),6) crossover. I've made some additions/changes based on my trading style.

  • I took out all the noise as I prefer my charts a bit cleaner. Completely personal preference here.
  • To catch the start of the run, I only display tickers who just performed the crossover.
  • I noticed these tend to run a lot longer if they are already in an uptrend (defined by me as close above wma(150)). It still works if the stock is in a downtrend, but the runs are short; a lot of times very short and not worth it to me.
  • I sorted the results by those in an uptrend first. Depending on how that goes, I may just remove the downtrend ones and only display the uptrends. Starting out, I want to see the performance of both trends.
Again, kudos to finding this pattern and an even bigger thank you for sharing. Looking quite promising.

index is dow 30

Set{EMA56LONG,count( ema(5) > cma(ema(5),6) ,1)}
draw EMA56LONG

Set{EMA56SHORT,count( ema(5) < cma(ema(5),6) ,1)}

ema56long > 0
ema56long 1 day ago equals 0

set{Uptrend,count(close > wma(150),1)}
set{Downtrend,count(close < wma(150),1)}
add column Uptrend
add column Downtrend
sort column 5 descending

draw ema(5)
draw cma(ema(5),6)
draw wma(150)

General Discussion · Learning
msg #158962
4/10/2022 1:56:45 PM

There are several swing-trading filters to determine trends. Chop Zone is good on non-choppy tickers. For example, not so good on EEM and XLP.

The issue, no filter is going to eliminate whipsaws. I use trend filters to inform how to trade.

Is the general market in uptrend (SPY, QQQ, DIA)? Then I trade aggressively.
Is it in a downtrend? I don't stop trading, but I do lower my participation drastically and use more bearish trades.
Choppy market? Use neutral strategies.



set{hlc3a,high + low}
set{hlc3b,hlc3a + close}
set{hlc3,hlc3b / 3}

set{pi,atan(number1) * 4}

set{h30,high 30-day high}
set{l30,low 30-day low}
set{range1,h30 - l30}
set{range2,range1 * l30}
set{range,25 / range2}

set{y2a,ema(34) 1 day ago - ema(34)}
set{y2b,hlc3 * range}
set{y2_ema34,y2a / y2b}

set{c1a,x2_ema34 - x1_ema34}
set{c1b,x2_ema34 - x1_ema34}
set{c1c,y2_ema34 - y1_ema34}
set{c1d,y2_ema34 - y1_ema34}
set{c1e,c1a * c1b}
set{c1f,c1c * c1d}
set{c1g,c1e + c1f}

set{emaAngle1,x2_ema34 - x1_ema34}
set{emaAngle2,emaAngle1 / c_ema34}
set{emaAngle3,emaAngle2 / pi}
set{emaAngle5,180 * emaAngle4}

set{emaAngle6,count(y2_ema34 > 0,1)}
set{emaAngle7,count(y2_ema34 < 0,1)}
set{emaAngle8,emaAngle7 - emaAngle6}
set{emaAngle,emaAngle8 * emaAngle_1}

set{LONG,count(emaAngle > 5,1)}
set{SHORT,count(emaAngle < -5,1)}

LONG > -1
SHORT > -1

General Discussion · Learning
msg #158955
4/9/2022 10:32:15 AM

@snappyfrog, I've been trading Iron Condors on IWM lately with success. It's trending sideways since February. The price lines below are my current breakevens for May 20 expiration. It's nice when they match up with the channel so closely.

General Discussion · Learning
msg #158951
4/8/2022 6:17:33 PM

This is so true, especially during downtrends. Trading isn't just something to do in bull markets. Everyone should learn strategies to make money both when the market is heading up and also when it's heading down.

Filter Exchange · 52 week high help
msg #158914
4/1/2022 7:54:26 AM

/* Your request */
count(high 1 day ago < high 52 week high 1 day ago,5) equals 5
high equals high 52 week high

/* Extra visuals, bells, and whistles */
add column separator
add column days(high 1 day ago equals high 52 week high 1 day ago,252) {Days since last 52-week high}
add column high 52 week high 1 day ago
add column high 52 week high

draw price line at high 52 week high 1 day ago
do not draw high 52 week high
sort column 6 descending

General Discussion · Compare price to price of another stock, e.g. SPY
msg #158911
3/31/2022 11:26:11 AM

set{my_indicator,close / SPY_close}

add column SPY_close
add column my_indicator

General Discussion · ATR above BB issue
msg #158861
3/22/2022 2:36:32 PM

Here is the filter you were attempting:

not otcbb
not etf

draw Upper Bollinger Band(20,2)
draw Lower Bollinger Band(20,2)
draw atr(21) on plot price
draw x2 on plot price
draw x3 on plot price

set{x1,atr(21) * 3}
set{x2,x1 + close}
set{x3,x1 - close}

x2 > Upper Bollinger Band(20,2)
x3 > Lower Bollinger Band(20,2)

close > 7
close > weekly upper bollinger band(20,2) 26 weeks ago
weekly average volume(30) > 3,000,000
close is less than 25% below high 52 week close

However, your methodology is flawed in trying to fit ATR(21) * 3 inside Bollinger Bands. Look at the individual calculations on PANW:

not otcbb
not etf

draw Upper Bollinger Band(20,2)
draw Lower Bollinger Band(20,2)
draw x1 on plot price
draw x2 on plot price
draw x3 on plot price

set{x1,atr(21) * 3}
set{x2,x1 + close}
set{x3,x1 - close}

add column separator
add column x1
add column separator
add column x2
set{UBB,Upper Bollinger Band(20,2)}
add column UBB
add column separator
add column x3
add column Lower Bollinger Band(20,2) {LBB}

x2 > Upper Bollinger Band(20,2)
x3 > Lower Bollinger Band(20,2)

close > 7
close > weekly upper bollinger band(20,2) 26 weeks ago
weekly average volume(30) > 3,000,000
close is less than 25% below high 52 week close

General Discussion · A possible true false logic alternative
msg #158816
3/14/2022 3:39:49 PM

I misunderstood your request. I thought you were testing basic vs advanced filters. I don't have any filters that fail to run in SF due to complexity as I delete any that break. I'll let you know if I come across any, though!

StockFetcher Forums ·  · << 1 ... 2 3 4 5 6 ... 50 >>

*** Disclaimer *** 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. does not recommend particular securities., 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.