LukeTheLifeHacker
New member
Hello Everyone,
I hope you're all doing well. I've been exploring the ThinkOrSwim platform and encountered a question that I haven't been able to resolve through documentation or other resources. I apologize if I'm missing something obvious here.
To illustrate my question, I'm using a script that calculates the Exponential Moving Average (EMA) based on the last 20 bars. The script is straightforward:
This script computes the EMA from the closing prices of the past 20 one-minute bars. However, my query arises in situations where there is a lack of trading activity for a specific bar. For instance, consider a scenario where there's no trading at 1:45 PM, within the 1:40-2:00 PM window.
My question is: How does ThinkOrSwim handle such missing data in its EMA calculation?
Thank you in advance for your help!
I hope you're all doing well. I've been exploring the ThinkOrSwim platform and encountered a question that I haven't been able to resolve through documentation or other resources. I apologize if I'm missing something obvious here.
To illustrate my question, I'm using a script that calculates the Exponential Moving Average (EMA) based on the last 20 bars. The script is straightforward:
Code:
// Script to calculate the Fast Exponential Moving Average (EMA).
input fastLength = 20;
script calc_fastEMA {
input source = close;
input length = fastLength;
def fastMA = MovAvgExponential(source, length);
plot out = fastMA;
}
def fastEMA = calc_fastEMA(close, fastLength);
plot FastEMAPlot = fastEMA;
FastEMAPlot.SetDefaultColor(Color.BLUE);
This script computes the EMA from the closing prices of the past 20 one-minute bars. However, my query arises in situations where there is a lack of trading activity for a specific bar. For instance, consider a scenario where there's no trading at 1:45 PM, within the 1:40-2:00 PM window.
My question is: How does ThinkOrSwim handle such missing data in its EMA calculation?
- Does it perform a forward-fill, using the close price of 1:44 PM as the price for the missing 1:45 PM bar?
- Or does it include an earlier bar (like the 1:39 PM bar) to ensure that the EMA is calculated over a full set of 20 bars with trading activity?
Thank you in advance for your help!