declare upper;
input short = 10;
input medium = 50;
input long = 150;
def SMA = Average(CLOSE, short);
def MMA = Average(CLOSE, medium);
def LMA = Average(CLOSE, long);
def trend = if LMA > LMA[1] then 1 else if LMA < LMA[1] then -1 else 0;
def enter_long = if SMA crosses above MMA AND trend == 1 then low else double.nan;
def enter_short = if SMA crosses below MMA AND trend == -1 then high else double.nan;
AddOrder(OrderType.BUY_AUTO, !isNaN(enter_long), open[-1], 50, Color.ORANGE, Color.ORANGE, "Sample buy @ " + open[-1]);
AddOrder(OrderType.SELL_AUTO, !isNaN(enter_short), open[-1], 50, Color.ORANGE, Color.ORANGE, "Sample sell @ " + open[-1]);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
declare upper;
input Fast = 9;
input AverageTypeFast = AverageType.SIMPLE;
input Medium = 20;
input AverageTypeMedium = AverageType.EXPONENTIAL;
input Slow = 50;
input AverageTypeSlow = AverageType.SIMPLE;
plot FMA = MovingAverage (AverageTypeFast, CLOSE, Fast);
plot MMA = MovingAverage (AverageTypeMedium, CLOSE, Medium);
plot SMA = MovingAverage (AverageTypeSlow, CLOSE, Slow);
def trend = if SMA > SMA[1] then 1 else if SMA < SMA[1] then -1 else 0;
def enter_long = if SMA crosses above MMA AND trend == 1 then low else double.nan;
def enter_short = if SMA crosses below MMA AND trend == -1 then high else double.nan;
AddOrder(OrderType.BUY_AUTO, !isNaN(enter_long), open[-1], 50, Color.GREEN, Color.Green, "Sample buy @ " + open[-1]);
AddOrder(OrderType.SELL_AUTO, !isNaN(enter_short), open[-1], 50, Color.RED, Color.RED, "Sample sell @ " + open[-1]);
FMA.SetDefaultColor(Color.YELLOW);
MMA.SetDefaultColor(Color.ORANGE);
SMA.SetDefaultColor(Color.RED);
Scott can you share how you incorporate RSI into your trading strategy? I am leaning towards a lower period RSI. The 14 period to me just seems to slow. What are your thoughts? Thank youMost trading / investing strategies are completely dependent on the time frame you want to work in, and adjust your systems / indicators accordingly. For example, I trade NQ futures, and although you could "try" to use futures for longer term "investing", you are really well advised to keep your time frames within the minutes, hours, or at most a few days. My typical holding period is minutes to hours maximum. Lately, at $20 per point per contract, NQ has moved 100 points ($2000) in minutes, and 500 points ($10,000) during the day. So, I will use moving averages in my strategy, but they are on a 2 minute chart. Shorter time MAs ( 3, 5, 9, 10) for entries, longer term MAs (20 & 50) for trend and direction. The crosses are quick, and the signals are clear. (Please note that I also use ADX and RSI very heavily in my trading system.) Because of the lag, I could never use MA crosses on a 15 minute, hour, or daily chart to trade for minutes to hours.
For longer term investors ( years holding), you can certainly use a daily chart and watch for longer term MA crosses such as 50, 100, 200 day MA crosses. This strategy has helped some longer term investors avoid big declines after a big rally (like we have just seen, 2008 - 2022) and get in long after a big decline ( such as after 2000 & 2008 declines) or very possibly after the potential big decline that we are currently working out. More so than any MA crosses, the overall economy and investing climate is much more important than any technical system you could use for "investing."
Using MAs to build a trading system is a good start, but should be enhanced with other indicators to fine tune them for trend and direction and entry triggers.
I also agree with @mashume that some strategies using MAs will not have extremely generous outcomes.
| Thread starter | Similar threads | Forum | Replies | Date |
|---|---|---|---|---|
| B | Help with Strategy Builder, 2 moving avg's with ATR | Questions | 0 | |
| M | Want Volume Spike Strategy with signal enter and exit | Questions | 0 | |
| S | Legging Out - Backtesting Strategy | Questions | 1 | |
|
|
BNF Tekashi Trading Strategy in thinkorswim script | Questions | 4 | |
|
|
MTF evaluation of Strategy | Questions | 3 |
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.