Decreasing Noise On 1Minute Timeframes

Glefdar

Active member
This is a great study. https://usethinkscript.com/threads/rsm-indicator-for-thinkorswim.5407/

I find that the chop on the 1minute time frame is too excessive, so I was trying to modify the script to use a 5min aggregation period on a 1min chart.

I pared down the script to what appears to be the essentials for just painting the plot (I replaced PriceColor for the candles with a line plot that would appear above them, but aside from the painting strategy being different, the signals should be identical).

However, I cannot get anything in this code to run when attempting to use a 5min aggregation period. I think it's because the referenced studies such as Stochastic Slow are not correct when I've tried to reproduce the full code (replacing the shortcut "Reference [Study Name]" for the purpose of setting the aggregation period for each fundamental of high, low, close etc. to 5min).

This is what I've got. The chart labels that should show the values for the variables used aren't showing at all, so the script isn't loading at all:

Code:
declare upper;
################################################################
##########                 Variables                   #########
################################################################

def agg = AggregationPeriod.FIVE_MIN;
input rangeType = { default "ADR", "ATR" };

################################################################
##########              ATR/ADR Calc                   #########
################################################################
input ATRlength = 14;
input ATRaverageType = AverageType.WILDERS;
def Range;
if rangeType == rangeType.ATR {
    Range = MovingAverage(ATRaverageType, TrueRange(high(period = "agg"), close(period = "agg"), low(period = "agg")), ATRlength);
} else {
    Range = Average(high(period = "agg") - low(period = "agg"), 7);
}


################################################################
##########           ADX Indicator Reference           #########
################################################################

input lengthADX = 21;
input averageType = AverageType.WILDERS;

def hiDiff = high(period = "agg") - high(period = "agg")[1];
def loDiff = low(period = "agg")[1] - low(period = "agg");

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = MovingAverage(averageType, TrueRange(high(period = "agg"), close(period = "agg"), low(period = "agg")), lengthADX);
plot "DI+" = 100 * MovingAverage(averageType, plusDM, lengthADX) / ATR;
plot "DI-" = 100 * MovingAverage(averageType, minusDM, lengthADX) / ATR;

def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
def ADX = MovingAverage(averageType, DX, lengthADX);

def ADXR = (ADX + ADX[lengthADX - 1]) / 2;


################################################################
##########                 RSI                         #########
################################################################
input lengthRSI = 7;
def price = close(period = "agg");
input averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, close(period = "agg") - close(period = "agg")[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close(period = "agg") - close(period = "agg")[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

################################################################
##########                 Stochastic Slow             #########
################################################################

def SFagg = AggregationPeriod.FIVE_MIN;
def SFover_bought = 80;
def SFover_sold = 20;
def SFKPeriod = 14;
def SFDPeriod = 3;
def SFpriceH = high(period = "SFagg");
def SFpriceL = low(period = "SFagg");
def SFpriceC = close(period = "SFagg");
def SFslowing_period = 3;
def SFaverageType = AverageType.WILDERS;
def SFlowest_k = Lowest(SFpriceL, SFKPeriod);
def SFc1 = SFpriceC - SFlowest_k;
def SFc2 = Highest(SFpriceH, SFKPeriod) - SFlowest_k;
def SFFastK = if SFc2 != 0 then SFc1 / SFc2 * 100 else 0;
def SlowK = MovingAverage(SFaverageType, SFFastK, SFslowing_period);
def SlowD = MovingAverage(SFaverageType, SlowK, SFDPeriod);


################################################################
##########                  MACD                       #########
################################################################
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
def Value = MovingAverage(averageTypeMACD, close(period = "agg"), fastLength) - MovingAverage(averageTypeMACD, close(period = "agg"), slowLength);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;


################################################################
##########         Assign Price Color                  #########
################################################################

# instead of paint bars:

plot paintbarsline = Average(high(period = "agg"), 5);
paintbarsline.SetPaintingStrategy(PaintingStrategy.LINE);
paintbarsline.SetLineWeight(3);
paintbarsline.AssignValueColor(if RSI > 50 and SlowK > 50 and Value > Avg then Color.GREEN else if RSI < 50 and SlowK < 50 and Value < Avg then Color.RED else Color.DARK_GRAY);

AddLabel(yes, RSI, Color.WHITE);
AddLabel(yes, SlowK, Color.WHITE);
AddLabel(yes, Value, Color.WHITE);
AddLabel(yes, Avg, Color.WHITE);

I realize this is a mess. If anyone else likes scalping with a 1min chart or time frame lower than 5 minutes, but is also finding that the signals are too choppy with a period under 5 minutes, I'm hoping someone may be interested in helping to get this working.
 
Last edited by a moderator:
Solution
@lmk99 I agree with @MerryDay. not everything is meant for 1m, as a matter of fact, personally 1m is pivot points hit or miss areas for me. if you are scalping on a min frame and market ordering, almost no indicator is necessary, that momentum is either or a news or some kind of market reaction to events.

All you need is price action.

As for the indicator, RSM, I use typically 15m and above. I do have a grid with Multiple timeframes configured and use RSM in all of them. 5m,15m,30m & 1H. I use 5m as a reference points not to jump in on trades, with out another higher frame confirmation.

I've gone ahead and added RSM to my 15M period side chart and kept the labels, but I'm not going to try to implement the arrows...
This is a great study. I find that the chop on the 1minute time frame is too excessive, so I was trying to modify the script to use a 5min aggregation period on a 1min chart.
I don't see the logic of your post. Could you provide a more detail explanation?
You stated that "the chop on the 1minute time frame is too excessive" so to counter the excessive chop, you want to use a 5min script on the 1min timeframe. The 5min script will repaint 4 out of 5 candles. Less chop, more false signals. The end result is still not tradable.
6urj716.png
 
Last edited:

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

I don't see the logic of your post. Could you provide a more detail explanation?
You stated that "the chop on the 1minute time frame is too excessive" so to counter the excessive chop, you are use a 5min script on the 1min timeframe. The 5min script will repaint 4 out of 5 candles. Less chop, more false signals. The end result is still not tradable.
6urj716.png

Good point, thanks for your reply. I'm thinking I could change the plot to use the arrows only when the previous 5min candle has closed. I think it wouldn't be too hard to make that modification once I got the study working with a higher period on the 1min chart. In other words, the repainting problem could be eliminated by using a signal (such as an arrow) that appears upon the close of the previous 5min period. That would make the signal 1 minute late, but having the closed/confirmed 5min period signal appear one minute late would be better than having all the chop of the 1min period.

This would offer the same benefit as having the MTF label (from this post) appear at the top of the 1min chart with the period set to 5m but with the added benefit that I still have some visual representation of how long the trend has lasted so far.

Maybe it's more trouble than it's worth given that the labels are already available though.
 
Good point, thanks for your reply. I'm thinking I could change the plot to use the arrows only when the previous 5min candle has closed. I think it wouldn't be too hard to make that modification once I got the study working with a higher period on the 1min chart. In other words, the repainting problem could be eliminated by using a signal (such as an arrow) that appears upon the close of the previous 5min period. That would make the signal 1 minute late, but having the closed/confirmed 5min period signal appear one minute late would be better than having all the chop of the 1min period.

This would offer the same benefit as having the MTF label (from this post) appear at the top of the 1min chart with the period set to 5m but with the added benefit that I still have some visual representation of how long the trend has lasted so far.

Maybe it's more trouble than it's worth given that the labels are already available though.
@lmk99 I agree with @MerryDay. not everything is meant for 1m, as a matter of fact, personally 1m is pivot points hit or miss areas for me. if you are scalping on a min frame and market ordering, almost no indicator is necessary, that momentum is either or a news or some kind of market reaction to events.

All you need is price action.

As for the indicator, RSM, I use typically 15m and above. I do have a grid with Multiple timeframes configured and use RSM in all of them. 5m,15m,30m & 1H. I use 5m as a reference points not to jump in on trades, with out another higher frame confirmation.
 
@lmk99 I agree with @MerryDay. not everything is meant for 1m, as a matter of fact, personally 1m is pivot points hit or miss areas for me. if you are scalping on a min frame and market ordering, almost no indicator is necessary, that momentum is either or a news or some kind of market reaction to events.

All you need is price action.

As for the indicator, RSM, I use typically 15m and above. I do have a grid with Multiple timeframes configured and use RSM in all of them. 5m,15m,30m & 1H. I use 5m as a reference points not to jump in on trades, with out another higher frame confirmation.

I've gone ahead and added RSM to my 15M period side chart and kept the labels, but I'm not going to try to implement the arrows from a higher time frame on the lower time frame chart because what you and MerryDay said changed my mind. Thanks for sharing your insights!
 
Solution
I've gone ahead and added RSM to my 15M period side chart and kept the labels, but I'm not going to try to implement the arrows from a higher time frame on the lower time frame chart because what you and MerryDay said changed my mind. Thanks for sharing your insights!
For time frame you neeed to define "AggregationPeriod" time to see other time frames.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
457 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