Input Bias = {default bull, bear};
Input Slope = .25;
plot Scan;
def SMA =
simpleMovingAvg(close,200)
;
def Slp =
(Absvalue(SMA - SMA[3]) / sma[3]) * 100 < Slope;
;
Switch (Bias) {
Case Bull:
Scan = High[1] < SMA
and low > SMA
and Slp
;
Case Bear:
Scan = Low[1] > SMA
and High < SMA
and Slp
;
;
}
Scan.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Input Bias = {default bull, bear};
Input Slope = .25;
plot Scan;
def SMA =
simpleMovingAvg(close,200)
;
def Slp =
(Absvalue(SMA - SMA[3]) / sma[3]) * 100 < Slope;
;
Switch (Bias) {
Case Bull:
Scan = High[1] < SMA
and low > SMA
and Slp
;
Case Bear:
Scan = Low[1] > SMA
and High < SMA
and Slp
;
;
}
Scan.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Joshua,Try this. The gap part is easy, and can be easily modified. The moving average being flat is more tricky, its relative and arbitrary. In this, its using a sample of the average's slope as a percentage of the average itself. There are other ways to go about this as well.
Code:Input Bias = {default bull, bear}; Input Slope = .25; plot Scan; def SMA = simpleMovingAvg(close,200) ; def Slp = (Absvalue(SMA - SMA[3]) / sma[3]) * 100 < Slope; ; Switch (Bias) { Case Bull: Scan = High[1] < SMA and low > SMA and Slp ; Case Bear: Scan = Low[1] > SMA and High < SMA and Slp ; ; } Scan.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Joshua,Try this. The gap part is easy, and can be easily modified. The moving average being flat is more tricky, its relative and arbitrary. In this, its using a sample of the average's slope as a percentage of the average itself. There are other ways to go about this as well.
Code:Input Bias = {default bull, bear}; Input Slope = .25; plot Scan; def SMA = simpleMovingAvg(close,200) ; def Slp = (Absvalue(SMA - SMA[3]) / sma[3]) * 100 < Slope; ; Switch (Bias) { Case Bull: Scan = High[1] < SMA and low > SMA and Slp ; Case Bear: Scan = Low[1] > SMA and High < SMA and Slp ; ; } Scan.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Actually, just looked at greenshot and it is for windows and I am on a Mac...Thanks, I tried with both Snagit, and apple screenshots but this message system in here (usethinkscript) wouldn't let me post either. I will try greenshot and see if that works. Joe
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.