use of conditional orders with Stochastics

SunWuKongMagic

New member
Just wanted to introduce myself.
I've been using ThinkScript lightly for about 6 months on Studies and Strategies. As well as some simple conditional orders on Exp moving Averages.

I'm looking at how I can set better stops in conditional orders eg with Stochastics.

At the moment I wait for good momentum then place a conditional sell on the following conditions
close < ExpAverage(close, 10)
or
close < ExpAverage(close, 5)

However this required close monitoring on my part to determine the conditions of momentum and the character of the stock.

My buy decisions are manual. based on news current technicals, Stochastics and MACD.

My go to stop otherwise is
close < ExpAverage(close, 50)

which is of course the final stop for investment while I bare the lost benefits of swing trades.

This is a recent strategy (below) I used to evaluate the its effectiveness. It is a simplified and modified version of one shared on this forum by the user Ajordan930
https://usethinkscript.com/threads/stoch-rsi-macd-bullish.21178/
With thanks, this allowed me to explore the concepts, learn and test it against the recent price action, in particular SOFI.

I have adjusted the oversold and underbought thresholds as sometimes the price action is too quick to register.
I am now looking into how I can better moderate this to remove the false hits, perhaps with the use of RSI, as with the original script. I am learning by building from simple foundations rather than just copying the whole thing. Like an art student copying the masters before finding my own style.

If anyone else has explored the use of conditional orders with Stochastics, I would be glad of the input as I'm a wee bit of a grommet on this.

Code:
# === Inputs ===
input slowKLength = 14;
input slowDLength = 3;
input maxLines = 10;

input UnderB = 30;
input OverS = 70;


# === Stochastic FullK ===
def fullK = reference StochasticFull(80,20,slowKLength, slowDLength,High, Low, Close,slowDLength, AverageType.SIMPLE).FullK;

# === Stochastic FullD ===
def fullD = reference StochasticFull(80,20,slowKLength, slowDLength,High, Low, Close,slowDLength, AverageType.SIMPLE).FullD;

# === Signal Logic ===
def bear = fullK > OverS and fullK <= fullD;
def bull = fullK < UnderB and fullK >= fullD;
def neutral = !bull and !bear;

# === Vertical Line Drawing with Limit ===
def signal = bull or bear;
def barCounter = if signal then barCounter[1] + 1 else barCounter[1];
def lastN = HighestAll(barCounter);
def showLine = barCounter >= lastN - maxLines;

AddVerticalLine(bull and showLine, "BULL", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(bear and showLine, "BEAR", Color.RED, Curve.SHORT_DASH);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
1059 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top