I am using Bollinger Bands, Keltner Channels to do some checks. I consistently notice that all the values of these indicators are completely wrong when I compare them to real data on my ThinkorSwim platform.

Is this a test environment problem? I don't have confidence to go live with this if the data on which I am basing my trading rules is incorrect.

Here is how I am initializing it: Note that even EMAs are wrong too, but I am trying to get BBs and KCs to work first. Relevant code given below:

I have added long entries and can confirm that values are completely off. Here is one example that you can check yourself with SPY data for 1-3-2022 date. Note that all BB and KC values are wrong:

[2022-01-03 Monday] SPY Squeeze Check: BB Upper: 478, BB Lower: 474, KC Upper: 480, KC Lower: 472, Squeeze: True

  1. //Here I am initializing SPY for example.
  2. var equity = AddEquity(ticker, Resolution.Daily);
  3. equity.SetDataNormalizationMode(DataNormalizationMode.Raw);
  1. //Setting up indicators for SPY. All this is happening in Intialize() function
  2. _ema8[ticker] = EMA(ticker, 8, Resolution.Daily);
  3. _ema21[ticker] = EMA(ticker, 21, Resolution.Daily);
  4. _ema34[ticker] = EMA(ticker, 34, Resolution.Daily);
  5. _bollingerBands[ticker] = BB(ticker, 20, 2, MovingAverageType.Simple, Resolution.Daily);
  6. _keltnerChannels[ticker] = KCH(ticker, 20, 1.5m, MovingAverageType.Simple, Resolution.Daily);

Author

Dee Znut

August 2024