$1000 off on MultiCharts with Advanced Strategy Pack – this Black Friday only! Learn more
+1 888 340 6572
MultiCharts Project Management
previous_open_issue.png
Go to the previous open issue
previous_issue.png
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
bug_report_small.png
Open Bug report MC-715

wrong calculation involving avgprice

action_vote_minus_faded.png
1
Votes
action_vote_plus_faded.png
next_issue.png
Go to the next issue (open or closed)
next_open_issue.png
Go to the next open issue
Description

when a calculation involves avgprice, MC retures a wrong answer.

Steps to reproduce this issue

use the following code :

input: testing_variable(avgprice of data1), printswitch(0);
value1=testing_variable-average(testing_variable,10);
if printswitch=1 then print(file("c:\avgprice_testing.txt")," Date : ",date, ". Time ",time_s," testing_variable = ", testing_variable, " average(testing_variable,10) = ", average(testing_variable,10), " difference = ", value1);

value1 is avgprice of data1 minus average(avgprice of data1,10),
the file shows that the value of value1 is wrong :

Date : 1111117.00. Time 90300.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.68 difference = 0.39
Date : 1111117.00. Time 90400.00 testing_variable = 1227.19 average(testing_variable,10) = 1227.59 difference = -0.28
Date : 1111117.00. Time 90500.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.58 difference = -0.14
Date : 1111117.00. Time 90600.00 testing_variable = 1227.38 average(testing_variable,10) = 1227.58 difference = 0.17
Date : 1111117.00. Time 90700.00 testing_variable = 1227.38 average(testing_variable,10) = 1227.54 difference = 0.40
Date : 1111117.00. Time 90800.00 testing_variable = 1227.19 average(testing_variable,10) = 1227.46 difference = 0.54
Date : 1111117.00. Time 90900.00 testing_variable = 1227.13 average(testing_variable,10) = 1227.38 difference = 0.75
Date : 1111117.00. Time 91000.00 testing_variable = 1226.69 average(testing_variable,10) = 1227.23 difference = 0.39
Date : 1111117.00. Time 91100.00 testing_variable = 1226.19 average(testing_variable,10) = 1227.09 difference = 0.16
Date : 1111117.00. Time 91200.00 testing_variable = 1226.50 average(testing_variable,10) = 1227.01 difference = 0.24

However, if you change the definition of testing_variable from avgprice of data1 to close of data1, the answer comes out correct using the same code:

Date : 1111117.00. Time 90300.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.63 difference = -0.38
Date : 1111117.00. Time 90400.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.60 difference = -0.35
Date : 1111117.00. Time 90500.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.60 difference = -0.35
Date : 1111117.00. Time 90600.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.55 difference = -0.30
Date : 1111117.00. Time 90700.00 testing_variable = 1227.50 average(testing_variable,10) = 1227.53 difference = -0.03
Date : 1111117.00. Time 90800.00 testing_variable = 1227.25 average(testing_variable,10) = 1227.45 difference = -0.20
Date : 1111117.00. Time 90900.00 testing_variable = 1227.00 average(testing_variable,10) = 1227.33 difference = -0.33
Date : 1111117.00. Time 91000.00 testing_variable = 1226.50 average(testing_variable,10) = 1227.18 difference = -0.67
Date : 1111117.00. Time 91100.00 testing_variable = 1226.00 average(testing_variable,10) = 1227.05 difference = -1.05
Date : 1111117.00. Time 91200.00 testing_variable = 1227.00 average(testing_variable,10) = 1227.03 difference = -0.03

Comments (0)
History
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targeted for
    MultiCharts 7.4 (RELEASED)
  • Status
    Released
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (3)
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Reproducability
    Not determined
  • Severity
    Critical
Attachments (0)
There is nothing attached to this issue
Commits (0)
There are no code checkins for this issue
Duplicate issues (0)
This issue does not have any duplicates