Simple MNQ/NQ Strategy For ThinkOrSwim

IPA

Member
UPDATE!!! MODIFIED MA CROSSOVER BUY ALERTS CODE BELOW !!!

I made this for a friend of mine to trade MNQ. I'm sure it works with more than MNQ/NQ. Maybe someone here can make it better. I tried to keep it as simple as possible. It does require patience and some understanding of price action. I hope this helps someone and I look forward to feedback.

It uses the following scripts.

MA Crossover Buy Alerts -- see below
Price Momentum Oscillator (PMO) Overload

Settings for each of the scripts.

MA Crossover Buy Alerts

macross.png

Price Momentum Oscillator (PMO) Overload

Default settings with security type changes to forex, rsi length 65, rsi over bought 80, rsi average type wilders.

You can use this strategy on any time frame depending on what type of trader you are. He doesn't have a lot of time to trade so I came up with it on the 2m timeframe. It does work well on the 1 hour time frame for more patient traders. I didn't cherry pick the chart below. It's simply the last trading day. Green lines are buy, red lines are sell. When the two lines are green, you get a BUY 100 signal, that candle closes (PMO will repaint until candle close), you buy/sell once price retraces to the first or second (up to you) line and only when it retraces to the first or second line. If you don't follow the rules, you'll lose. From what I found coming up with this for him. R:R minimum is 1:1. So a good SL is 50 ticks and a good TP is 50 ticks. After 40 ticks you can move to break even. A lot of the time you can get more than 50 ticks if you trail and/or move to break even.

strat.png


I made a mistake with this. I modified the MA Crossover Buy Alerts!

#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © rouxam
#// This simple study generates alerts for buying at MA Crossover in 3commas
#// The alerts are best combined with a DCA bot like 3commas.
#// This works very well on sideways markets with small Take Profits <= 0.6%
#study("MA Crossover Buy Alerts", shorttitle="MA crossover", overlay=true)
# converted by Sam4Cok@Samer800 - request from useThinkScript.com member - 06/2023
# update - added MTF option and Sell Signals by Sam4Cok@Samer800 - 06/2023;
input ShowVerticalLine = yes;
input ma_type = {SMA, EMA, WMA, HullMA, VWMA, RMA, default TEMA};
input useChartTimeframeForSlowMa = {Default "Yes", "No"};
input manualSlowMaTimeframe = AggregationPeriod.FIFTEEN_MIN;
input slow_ma_period = 100; # "Slow MA Period"
input useChartTimeframeForFastMa = {Default "Yes", "No"};
input manualFastMaTimeframe = AggregationPeriod.FIFTEEN_MIN;
input fast_ma_period = 20; # "Fast MA Period"

def na = Double.NaN;

def c; def v; def l; def h;
def c1; def v1;

switch (useChartTimeframeForSlowMa) {
case "Yes" :
c = close;
v = volume;
l = low;
h = high;
case "No" :
c = close(Period=manualSlowMaTimeframe);
v = volume(Period=manualSlowMaTimeframe);
l = low(Period=manualSlowMaTimeframe);
h = high(Period=manualSlowMaTimeframe);
}
switch (useChartTimeframeForFastMa) {
case "Yes" :
c1 = close;
v1 = volume;
case "No" :
c1 = close(Period=manualFastMaTimeframe);
v1 = volume(Period=manualFastMaTimeframe);
}

#get_ma(src, ma_type, len) =>
script get_ma {
input src = close;
input ma_type = "TEMA";
input len = 100;
input v = Volume;
def hullma = HullMovingAvg(src, len);
def vwma = Average(src * v, len) / Average(v, len);
def ema1 = ExpAverage(src, len);
def ema2 = ExpAverage(ema1, len);
def ema3 = ExpAverage(ema2, len);
def tema = 3 * (ema1 - ema2) + ema3;
def ma = if ma_type == "SMA" then Average(src, len) else
if ma_type == "EMA" then ExpAverage(src, len) else
if ma_type == "WMA" then WMA(src, len) else
if ma_type == "HullMA" then hullma else
if ma_type == "VWMA" then vwma else
if ma_type == "RMA" then WildersAverage(src, len) else tema;
plot out = ma;
}

#// Calculate Fast and Slow Moving averages
def fast_ma = get_ma(c1, ma_type, fast_ma_period, v1);
def slow_ma = get_ma(c, ma_type, slow_ma_period, v);
def slow_ma_up = slow_ma > slow_ma[1];
def slow_ma_dn = slow_ma < slow_ma[1];
#// Buy signal: MA Crossover, with slow MA trending upwards
#def buy = crosses(fast_ma, slow_ma, CrossingDirection.ABOVE) and slow_ma_up;
def buy = (fast_ma > slow_ma) and (fast_ma[1] <= slow_ma[1]) and slow_ma_up;
def sell = (fast_ma < slow_ma) and (fast_ma[1] >= slow_ma[1]) and slow_ma_dn;
#// Low-pass filter to avoid generating too many consecutive orders
def checkbuy = buy and !buy[1] and !buy[2] and !buy[3] and !buy[4] and !buy[5] and !buy[6];
def checksell = sell and !sell[1] and !sell[2] and !sell[3] and !sell[4] and !sell[5] and !sell[6];
def buy_signal = checkbuy;
def sell_signal = checksell;

#// Plot color: Green if fast MA higher than slow MA
def col = fast_ma >= slow_ma;
plot FastMovingAverage = fast_ma;#, title="Fast Moving Average"
plot SlowMovingAverage = slow_ma;#, title="Slow Moving Average"

FastMovingAverage.SetLineWeight(2);
FastMovingAverage.AssignValueColor(if col then Color.RED else Color.GREEN);
SlowMovingAverage.AssignValueColor(if col then Color.RED else Color.GREEN);

#AddChartBubble(buy_signal, l, "Buy", Color.GREEN, no);
#AddChartBubble(sell_signal, h, "Sell", Color.RED, yes);

AddVerticalLine(ShowVerticalLine and buy_signal, "Buy", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(ShowVerticalLine and sell_signal, "Sell", Color.RED, Curve.SHORT_DASH);

#-- END of CODE
 
Last edited by a moderator:

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

Hello, thank you for sharing this. I will try this out. Can you please share your chart? I want to make sure I have the right set up.
Secondly, if I understand this correctly, you need to wait for two lines to cross then you you wait for buy signal right? What if buy signal comes first and then we get the crossover?
 
UPDATE!!! MODIFIED MA CROSSOVER BUY ALERTS CODE BELOW !!!

I made this for a friend of mine to trade MNQ. I'm sure it works with more than MNQ/NQ. Maybe someone here can make it better. I tried to keep it as simple as possible. It does require patience and some understanding of price action. I hope this helps someone and I look forward to feedback.

It uses the following scripts.

MA Crossover Buy Alerts -- see below
Price Momentum Oscillator (PMO) Overload

Settings for each of the scripts.

MA Crossover Buy Alerts

View attachment 20271
Price Momentum Oscillator (PMO) Overload

Default settings with security type changes to forex, rsi length 65, rsi over bought 80, rsi average type wilders.

You can use this strategy on any time frame depending on what type of trader you are. He doesn't have a lot of time to trade so I came up with it on the 2m timeframe. It does work well on the 1 hour time frame for more patient traders. I didn't cherry pick the chart below. It's simply the last trading day. Green lines are buy, red lines are sell. When the two lines are green, you get a BUY 100 signal, that candle closes (PMO will repaint until candle close), you buy/sell once price retraces to the first or second (up to you) line and only when it retraces to the first or second line. If you don't follow the rules, you'll lose. From what I found coming up with this for him. R:R minimum is 1:1. So a good SL is 50 ticks and a good TP is 50 ticks. After 40 ticks you can move to break even. A lot of the time you can get more than 50 ticks if you trail and/or move to break even.

View attachment 20273

I made a mistake with this. I modified the MA Crossover Buy Alerts!

#// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
#// © rouxam
#// This simple study generates alerts for buying at MA Crossover in 3commas
#// The alerts are best combined with a DCA bot like 3commas.
#// This works very well on sideways markets with small Take Profits <= 0.6%
#study("MA Crossover Buy Alerts", shorttitle="MA crossover", overlay=true)
# converted by Sam4Cok@Samer800 - request from useThinkScript.com member - 06/2023
# update - added MTF option and Sell Signals by Sam4Cok@Samer800 - 06/2023;
input ShowVerticalLine = yes;
input ma_type = {SMA, EMA, WMA, HullMA, VWMA, RMA, default TEMA};
input useChartTimeframeForSlowMa = {Default "Yes", "No"};
input manualSlowMaTimeframe = AggregationPeriod.FIFTEEN_MIN;
input slow_ma_period = 100; # "Slow MA Period"
input useChartTimeframeForFastMa = {Default "Yes", "No"};
input manualFastMaTimeframe = AggregationPeriod.FIFTEEN_MIN;
input fast_ma_period = 20; # "Fast MA Period"

def na = Double.NaN;

def c; def v; def l; def h;
def c1; def v1;

switch (useChartTimeframeForSlowMa) {
case "Yes" :
c = close;
v = volume;
l = low;
h = high;
case "No" :
c = close(Period=manualSlowMaTimeframe);
v = volume(Period=manualSlowMaTimeframe);
l = low(Period=manualSlowMaTimeframe);
h = high(Period=manualSlowMaTimeframe);
}
switch (useChartTimeframeForFastMa) {
case "Yes" :
c1 = close;
v1 = volume;
case "No" :
c1 = close(Period=manualFastMaTimeframe);
v1 = volume(Period=manualFastMaTimeframe);
}

#get_ma(src, ma_type, len) =>
script get_ma {
input src = close;
input ma_type = "TEMA";
input len = 100;
input v = Volume;
def hullma = HullMovingAvg(src, len);
def vwma = Average(src * v, len) / Average(v, len);
def ema1 = ExpAverage(src, len);
def ema2 = ExpAverage(ema1, len);
def ema3 = ExpAverage(ema2, len);
def tema = 3 * (ema1 - ema2) + ema3;
def ma = if ma_type == "SMA" then Average(src, len) else
if ma_type == "EMA" then ExpAverage(src, len) else
if ma_type == "WMA" then WMA(src, len) else
if ma_type == "HullMA" then hullma else
if ma_type == "VWMA" then vwma else
if ma_type == "RMA" then WildersAverage(src, len) else tema;
plot out = ma;
}

#// Calculate Fast and Slow Moving averages
def fast_ma = get_ma(c1, ma_type, fast_ma_period, v1);
def slow_ma = get_ma(c, ma_type, slow_ma_period, v);
def slow_ma_up = slow_ma > slow_ma[1];
def slow_ma_dn = slow_ma < slow_ma[1];
#// Buy signal: MA Crossover, with slow MA trending upwards
#def buy = crosses(fast_ma, slow_ma, CrossingDirection.ABOVE) and slow_ma_up;
def buy = (fast_ma > slow_ma) and (fast_ma[1] <= slow_ma[1]) and slow_ma_up;
def sell = (fast_ma < slow_ma) and (fast_ma[1] >= slow_ma[1]) and slow_ma_dn;
#// Low-pass filter to avoid generating too many consecutive orders
def checkbuy = buy and !buy[1] and !buy[2] and !buy[3] and !buy[4] and !buy[5] and !buy[6];
def checksell = sell and !sell[1] and !sell[2] and !sell[3] and !sell[4] and !sell[5] and !sell[6];
def buy_signal = checkbuy;
def sell_signal = checksell;

#// Plot color: Green if fast MA higher than slow MA
def col = fast_ma >= slow_ma;
plot FastMovingAverage = fast_ma;#, title="Fast Moving Average"
plot SlowMovingAverage = slow_ma;#, title="Slow Moving Average"

FastMovingAverage.SetLineWeight(2);
FastMovingAverage.AssignValueColor(if col then Color.RED else Color.GREEN);
SlowMovingAverage.AssignValueColor(if col then Color.RED else Color.GREEN);

#AddChartBubble(buy_signal, l, "Buy", Color.GREEN, no);
#AddChartBubble(sell_signal, h, "Sell", Color.RED, yes);

AddVerticalLine(ShowVerticalLine and buy_signal, "Buy", Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(ShowVerticalLine and sell_signal, "Sell", Color.RED, Curve.SHORT_DASH);

#-- END of CODE
thank you very much for share this great system. do you mine share the your chart with us, i mean with the strategy? thank you in advance


IPA can you add a arrow instead the vertical line? that will be good. thank you in advance
 
Last edited by a moderator:
Hello, thank you for sharing this. I will try this out. Can you please share your chart? I want to make sure I have the right set up.
Secondly, if I understand this correctly, you need to wait for two lines to cross then you you wait for buy signal right? What if buy signal comes first and then we get the crossover?

You're welcome. There is a chart in the first post with a description on how to use the strategy 🙌
 
thank you very much for share this great system. do you mine share the your chart with us, i mean with the strategy? thank you in advance


IPA can you add a arrow instead the vertical line? that will be good. thank you in advance

There is a chart in the first post but here is the 1 hour to maybe better illustrate.

1703874417317.png


1704514852023.png


Here is one from 1/5/24 on the 1 hour I watched. Almost 100 points.
 
Last edited by a moderator:
Very cool indicator great work! It looks like the red lines appear when going long and green lines appear when going short from the original indicator. Is there anyway to setup a scanner for the vertical lines?
 
There is a chart in the first post but here is the 1 hour to maybe better illustrate.

View attachment 20562

View attachment 20630

Here is one from 1/5/24 on the 1 hour I watched. Almost 100 points.
Hi IPA,

Thank you very much for sharing the strategy. Was just checking the charts with the suggested settings - RMA with 5, 13 from post #1 but its not matching with your 1 hr posted chart from 01/05/24
Are you using the same settings or different MA lengths?
1705183275692.png
 
Last edited by a moderator:

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
326 Online
Create Post

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