I tried to upload them but it is not allowed in this forum.
To replicate the issue,
[1] Create a chart with 6 future options symbols
- all 1 min resolution
- all 1 day back
- all having session from 0900 through 1630
- the actual market ends at 1515 with the last tick of the day
[2] Apply test1 indicator which has Print(time) at the end.
Code: Select all
var: strike1(0), strike2(0), K1temp(0), K2temp(0);
var: DaysRem(0), Now(0), StartTime(0), TimeDivide(0), TTM(0);
var: cdrate(0), FwdAtm1(0), FwdAtm2(0), Fwd(0);
var: callvol1(0), callvol2(0), CK1(0), CK2(0), delta1(0), delta2(0), deltaratio(0);
var: Cnt(0), ret1open(0), retg1sum(0), ret2(0), ret2sum(0), retAll(0);
// Variables!
cdrate = AAA_Variables(1);
DaysRem = AAA_Variables(2);
StartTime = AAA_Variables(3);
TimeDivide = AAA_Variables(4);
///////////////////////////////////
K1temp = StrToNum(MidStr(symbolname,6,3));
K2temp = StrToNum(MidStr(symbolname of data3,6,3));
print(t);
strike1 = Round(K1temp/2.5,0) * 2.5;
strike2 = Round(K2temp/2.5,0) * 2.5;
Now = TimeToMinutes(Time);
TTM = (DaysRem - (Now - StartTime + 1) / TimeDivide) / 252;
FwdAtm1 = (c[1] - c[1] of data2) * expvalue(cdrate * TTM) + strike1;
FwdAtm2 = (c[1] of data3 - c[1] of data4) * expvalue(cdrate * TTM) + strike2;
Fwd = (FwdAtm1 + FwdAtm2 ) / 2;
CK1 = Round(StrToNum(MidStr(symbolname of data5,6,3)) / 2.5, 0) * 2.5;
CK2 = Round(StrToNum(MidStr(symbolname of data6,6,3)) / 2.5, 0) * 2.5;
callvol1 = AAA_Fimvol(1, Fwd, CK1, cdrate, TTM, c[1] of data5);
callvol2 = AAA_Fimvol(1, Fwd, CK2, cdrate, TTM, c[1] of data6);
delta1 = AAA_Fdelta(1, Fwd, CK1, cdrate, TTM, callvol1);
delta2 = AAA_Fdelta(1, Fwd, CK2, cdrate, TTM, callvol2);
deltaratio = delta1/delta2;
if Cnt = 0 then begin
ret1open = c of data5;
//ret1sum = 0;
Cnt = Cnt + 1;
//tmptime = t;
end;
print(time);
However, it misses and/or duplicates some bars as shown below.
Am I missing something here?
901.00
907.00
907.00
907.00
907.00
907.00
907.00
908.00
908.00
909.00
909.00
910.00
910.00
911.00
911.00
912.00
912.00
913.00
913.00
914.00
914.00
915.00
915.00
916.00
916.00
917.00
917.00
918.00
918.00
919.00
919.00
920.00
920.00
921.00
921.00
922.00
922.00
923.00
923.00
924.00
924.00
925.00
925.00
926.00
926.00
927.00
927.00
928.00
928.00
929.00
929.00
930.00
930.00
931.00
931.00
932.00
932.00
933.00
933.00
934.00
934.00
935.00
935.00
936.00
936.00
937.00
937.00
938.00
938.00
939.00
939.00
940.00
940.00
941.00
941.00
942.00
942.00
943.00
943.00
944.00
944.00
944.00
944.00
946.00
946.00
947.00
947.00
948.00
948.00
949.00
949.00
949.00
949.00
949.00
949.00
952.00
952.00
952.00
952.00
952.00
952.00
952.00
952.00
956.00
956.00
957.00
957.00
958.00
958.00
959.00
959.00
1000.00
1000.00
1001.00
1001.00
1001.00
1001.00
1001.00
1001.00
1004.00
1004.00
1004.00
1004.00
1004.00
1004.00
1004.00
1004.00
1008.00
1008.00
1009.00
1009.00
1010.00
1010.00
1011.00
1011.00
1012.00
1012.00
1012.00
1012.00
1014.00
1014.00
1015.00
1015.00
1016.00
1016.00
1017.00
1017.00
1018.00
1018.00
1019.00
1019.00
1020.00
1020.00
1020.00
1020.00
1022.00
1022.00
1022.00
1022.00
1024.00
1024.00
1025.00
1025.00
1026.00
1026.00
1026.00
1026.00
1028.00
1028.00
1029.00
1029.00
1030.00
1030.00
1031.00
1031.00
1032.00
1032.00
1033.00
1033.00
1034.00
1034.00
1035.00
1035.00
1036.00
1036.00
1037.00
1037.00
1038.00
1038.00
1039.00
1039.00
1040.00
1040.00
1040.00
1040.00
1042.00
1042.00
1043.00
1043.00
1044.00
1044.00
1045.00
1045.00
1046.00
1046.00
1047.00
1047.00
1048.00
1048.00
1049.00
1049.00
1050.00
1050.00
1051.00
1051.00
1052.00
1052.00
1052.00
1052.00
1054.00
1054.00
1054.00
1054.00
1054.00
1054.00
1057.00
1057.00
1058.00
1058.00
1058.00
1058.00
1058.00
1058.00
1101.00
1101.00
1101.00
1101.00
1103.00
1103.00
1104.00
1104.00
1105.00
1105.00
1106.00
1106.00
1107.00
1107.00
1107.00
1107.00
1107.00
1107.00
1110.00
1110.00
1111.00
1111.00
1112.00
1112.00
1112.00
1112.00
1114.00
1114.00
1115.00
1115.00
1116.00
1116.00
1116.00
1116.00
1118.00
1118.00
1118.00
1118.00
1120.00
1120.00
1121.00
1121.00
1122.00
1122.00
1123.00
1123.00
1124.00
1124.00
1124.00
1124.00
1124.00
1124.00
1127.00
1127.00
1128.00
1128.00
1129.00
1129.00
1130.00
1130.00
1130.00
1130.00
1130.00
1130.00
1133.00
1133.00
1134.00
1134.00
1135.00
1135.00
1136.00
1136.00
1136.00
1136.00
1138.00
1138.00
1138.00
1138.00
1138.00
1138.00
1138.00
1138.00
1142.00
1142.00
1143.00
1143.00
1143.00
1143.00
1143.00
1143.00
1146.00
1146.00
1146.00
1146.00
1148.00
1148.00
1148.00
1148.00
1148.00
1148.00
1151.00
1151.00
1151.00
1151.00
1153.00
1153.00
1154.00
1154.00
1155.00
1155.00
1156.00
1156.00
1157.00
1157.00
1158.00
1158.00
1159.00
1159.00
1200.00
1200.00
1200.00
1200.00
1200.00
1200.00
1203.00
1203.00
1204.00
1204.00
1205.00
1205.00
1206.00
1206.00
1207.00
1207.00
1208.00
1208.00
1209.00
1209.00
1210.00
1210.00
1211.00
1211.00
1211.00
1211.00
1213.00
1213.00
1213.00
1213.00
1213.00
1213.00
1216.00
1216.00
1217.00
1217.00
1218.00
1218.00
1219.00
1219.00
1220.00
1220.00
1221.00
1221.00
1221.00
1221.00
1223.00
1223.00
1224.00
1224.00
1224.00
1224.00
1226.00
1226.00
1227.00
1227.00
1228.00
1228.00
1228.00
1228.00
1230.00
1230.00
1231.00
1231.00
1232.00
1232.00
1233.00
1233.00
1234.00
1234.00
1235.00
1235.00
1236.00
1236.00
1237.00
1237.00
1237.00
1237.00
1239.00
1239.00
1240.00
1240.00
1241.00
1241.00
1241.00
1241.00
1241.00
1241.00
1244.00
1244.00
1244.00
1244.00
1246.00
1246.00
1246.00
1246.00
1246.00
1246.00
1249.00
1249.00
1250.00
1250.00
1251.00
1251.00
1251.00
1251.00
1253.00
1253.00
1254.00
1254.00
1254.00
1254.00
1256.00
1256.00
1257.00
1257.00
1258.00
1258.00
1258.00
1258.00
1300.00
1300.00
1301.00
1301.00
1302.00
1302.00
1303.00
1303.00
1304.00
1304.00
1304.00
1304.00
1306.00
1306.00
1306.00
1306.00
1308.00
1308.00
1309.00
1309.00
1309.00
1309.00
1311.00
1311.00
1312.00
1312.00
1312.00
1312.00
1314.00
1314.00
1315.00
1315.00
1315.00
1315.00
1315.00
1315.00
1315.00
1315.00
1319.00
1319.00
1320.00
1320.00
1321.00
1321.00
1321.00
1321.00
1321.00
1321.00
1321.00
1321.00
1325.00
1325.00
1326.00
1326.00
1327.00
1327.00
1328.00
1328.00
1329.00
1329.00
1329.00
1329.00
1329.00
1329.00
1332.00
1332.00
1333.00
1333.00
1333.00
1333.00
1333.00
1333.00
1333.00
1333.00
1333.00
1333.00
1338.00
1338.00
1338.00
1338.00
1338.00
1338.00
1338.00
1338.00
1342.00
1342.00
1342.00
1342.00
1342.00
1342.00
1345.00
1345.00
1345.00
1345.00
1345.00
1345.00
1348.00
1348.00
1348.00
1348.00
1350.00
1350.00
1351.00
1351.00
1351.00
1351.00
1351.00
1351.00
1351.00
1351.00
1351.00
1351.00
1356.00
1356.00
1357.00
1357.00
1357.00
1357.00
1359.00
1359.00
1359.00
1359.00
1359.00
1359.00
1402.00
1402.00
1403.00
1403.00
1403.00
1403.00
1403.00
1403.00
1406.00
1406.00
1406.00
1406.00
1408.00
1408.00
1409.00
1409.00
1410.00
1410.00
1411.00
1411.00
1412.00
1412.00
1413.00
1413.00
1414.00
1414.00
1415.00
1415.00
1416.00
1416.00
1417.00
1417.00
1418.00
1418.00
1419.00
1419.00
1420.00
1420.00
1421.00
1421.00
1422.00
1422.00
1423.00
1423.00
1424.00
1424.00
1424.00
1424.00
1426.00
1426.00
1427.00
1427.00
1428.00
1428.00
1429.00
1429.00
1429.00
1429.00
1431.00
1431.00
1431.00
1431.00
1433.00
1433.00
1434.00
1434.00
1434.00
1434.00
1436.00
1436.00
1436.00
1436.00
1438.00
1438.00
1439.00
1439.00
1440.00
1440.00
1441.00
1441.00
1442.00
1442.00
1443.00
1443.00
1444.00
1444.00
1445.00
1445.00
1446.00
1446.00
1446.00
1446.00
1448.00
1448.00
1449.00
1449.00
1450.00
1450.00
1451.00
1451.00
1452.00
1452.00
1453.00
1453.00
1454.00
1454.00
1455.00
1455.00
1456.00
1456.00
1457.00
1457.00
1458.00
1458.00
1458.00
1458.00
1500.00
1500.00
1501.00
1501.00
1502.00
1502.00
1502.00
1502.00
1504.00
1504.00
1505.00
1505.00
1516.00
1516.00