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
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.
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
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
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.
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: