Possibly A Bug when a script is applied for tick chart?

Questions about MultiCharts and user contributed studies.
2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Possibly A Bug when a script is applied for tick chart?

Postby 2haerim » 16 Oct 2008

The indicator below has 3 if statements which are effectively the same.
When it is applied for a tick chart, the third if statement gets never executed as shown in the log.

Please explain what is wrong.


Code: Select all

Input:
     F_Total_Ask (c of data2),
     F_Total_Bid (c of data3);
   
   value1=F_Total_Ask;
   value2=F_Total_Bid;
   value3=F_Total_Ask-F_Total_Ask[1];
   value4=value1-value1[1];
        
   if   F_Total_Ask-F_Total_Ask[1]>50 then begin
      print(d,t,"F_Total_Ask-F_Total_Ask[1]>50");
   end;
   
   if   value3>50 then begin
        print(d,t,"value3>50");
   end;
    
[color=red][b]   if   value4>50 then begin
        print(d,t,"value4>50");
   end; [/b][/color]


========output from the above indicator===============

Code: Select all

1081016.00 900.00value4>50
1081016.00 900.00value4>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 900.00value4>50
1081016.00 900.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 900.00value3>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 901.00value4>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 901.00value4>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 901.00value4>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 901.00value4>50
1081016.00 901.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 901.00value3>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 902.00value4>50
1081016.00 902.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 902.00value3>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00value4>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00value4>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00value4>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00value4>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50
1081016.00 903.00value3>50
1081016.00 903.00F_Total_Ask-F_Total_Ask[1]>50

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 28 Oct 2008

Hi HaeRim,

Add the following line to your indicator:

Code: Select all

print("currentbar ",currentbar, " value1 ", value1, " value1[1] ", value1[1], " Ask ", F_Total_Ask, " Ask[1] ", F_Total_Ask[1]);


and you will see right away how the indicator is calculated. You will see something like:

----
currentbar 3.00 value1 95.09 value1[1] 95.12 A 95.09 A[1] 95.12
currentbar 3.00 value1 93.78 value1[1] 95.12 A 93.78 A[1] 95.09
currentbar 3.00 value1 93.78 value1[1] 95.12 A 93.78 A[1] 95.09
currentbar 4.00 value1 93.78 value1[1] 95.09 A 93.78 A[1] 95.09
currentbar 4.00 value1 95.74 value1[1] 95.09 A 95.74 A[1] 93.78
currentbar 4.00 value1 95.74 value1[1] 95.09 A 95.74 A[1] 93.78
currentbar 5.00 value1 95.74 value1[1] 93.78 A 95.74 A[1] 93.78
currentbar 5.00 value1 96.79 value1[1] 93.78 A 96.79 A[1] 95.74
currentbar 5.00 value1 96.79 value1[1] 93.78 A 96.79 A[1] 95.74

----

Variable value1 changes in the context of data1. You want it to change within the context of data2.

====

To make the code work the way you want, you would need to upgrade. Install 4.0 release and make the following changes to your code:

insted of

Code: Select all

value4=value1-value1[1];


use:

Code: Select all

var:
   vrs(0, data2);
   
   vrs = F_Total_Ask;
   value4 = vrs-vrs[1];


Regards.

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Postby 2haerim » 29 Oct 2008

Variable value1 changes in the context of data1. You want it to change within the context of data2.


What is the meaning of "changes in the context of dataN"?

There are many scenarios related to using dataN along with subchart.

One can use data1 in the PL script and plot or apply it based on subchart 2 or vice versa.

When we are dealing with a quite a complicated program like MC, all the terms should and clean and clear defintions.

I wish there are some threads gathering very detail definitions of all the terminologies used by MC/PL/QM and so on. Maybe MC wiki would be good so that users could contribute.


Return to “MultiCharts”