Back to Community
Please HELP ME: SMA value delay

Hello every expert :-)
Sorry for the mistake,
The code attached is showing the SMA 10& SMA 30 for USEquityprice.close, but I found out every SMA 10/30 values are delayed by 1 day.

e.g. on 4/19, the SMA 10 is showing the value which is actually calculated from 4/18, even though I schedule the function is running at the market close spot.
I check the SMA 10 in tradingview as well, the SMA 10(AEY) on 4/19 should be 1.820, SMA 10(AEY) on 4/18 should be 1.824,SMA 10(AEY) on 4/17 should be 1.831

here is the backtest log:

2017-04-18 15:59  PRINT                       sma_10    sma_30  
Equity(21 [AAME])   3.876926  3.834567  
Equity(117 [AEY])   1.832000  1.879833  
Equity(157 [AEG])   4.946000  5.337833  
Equity(225 [AHPI])  1.988600  1.963414  
Equity(392 [AMS])   4.582400  4.243300  
2017-04-19 15:59  PRINT                      sma_10    sma_30  
Equity(21 [AAME])   3.86386  3.838785  
Equity(117 [AEY])   1.82400  1.877500  
Equity(157 [AEG])   4.91550  5.309667  
Equity(225 [AHPI])  1.98460  1.965069  
Equity(392 [AMS])   4.56500  4.254967  

I think this is because the algo assumes to run 1 min before the market close, so I can't get the current SMA value.
Does anyone can help me to get the current SMA value

Clone Algorithm
0
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 58f93835400521619241f938
There was a runtime error.