# Problem to code it

Questions about MultiCharts and user contributed studies.
shivax
Posts:90
Joined:02 Sep 2013
Has thanked: 37 times
Problem to code it
hi

Code: Select all

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=AverageFC(Atr(14),AvgAtr)>0;

if i set AvgAtr(0) it give me error in decimal point

But i if code : If AvgAtr>0 then ....

it should not execute the next code or not?

TJ
Posts:7367
Joined:29 Aug 2006
Location:Global Citizen
Has thanked: 995 times
Been thanked: 2103 times

### Re: Problem to code it

hi

Code: Select all

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=AverageFC(Atr(14),AvgAtr)>0;

if i set AvgAtr(0) it give me error in decimal point

But i if code : If AvgAtr>0 then ....

it should not execute the next code or not?

Please make a screen shot of the error message.

Please describe what do you want to achieve.

shivax
Posts:90
Joined:02 Sep 2013
Has thanked: 37 times

### Re: Problem to code it

Code: Select all

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=AverageFC(Atr(14),AvgAtr)>0;

if i set AvgAtr(0) it give me error in decimal point

shivax
Posts:90
Joined:02 Sep 2013
Has thanked: 37 times

### Re: Problem to code it

this is the error

but if i set Avg=0 it does not do the rest of the code
Attachments
immagine.png

shivax
Posts:90
Joined:02 Sep 2013
Has thanked: 37 times

### Re: Problem to code it

someone help me? thank

TJ
Posts:7367
Joined:29 Aug 2006
Location:Global Citizen
Has thanked: 995 times
Been thanked: 2103 times

### Re: Problem to code it

someone help me? thank

TJ
Posts:7367
Joined:29 Aug 2006
Location:Global Citizen
Has thanked: 995 times
Been thanked: 2103 times

### Re: Problem to code it

shivax
Posts:90
Joined:02 Sep 2013
Has thanked: 37 times

### Re: Problem to code it

hi

Code: Select all

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=AverageFC(Atr(14),AvgAtr)>0;

if i set AvgAtr(0) it give me error in decimal point

But i if code : If AvgAtr>0 then ....

it should not execute the next code or not?

Please make a screen shot of the error message.

Please describe what do you want to achieve.

1)
Immagine1.png
2)

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=AverageFC(Atr(14),AvgAtr)>0;

if i set 0 in AvgAtr (AvgAtr(0)) it give me error in decimal point

I want the code not to be executed if I put the parameter zero

I also ask you: why is it executed (AverageFC(Atr(14),AvgAtr)) if the condition is false?

I apologize for my english..I hope you understand

wilkinsw
Posts:604
Joined:21 Apr 2013
Has thanked: 144 times
Been thanked: 94 times

### Re: Problem to code it

Code: Select all

Input:AvgAtr(0);

condition1=true;
if AvgAtr>0 then condition1=Average(Atr(14),AvgAtr)>0;
Solution above.

I recommend reading up on simple and series functions. In a nutshell series are faster but come with limitations. Read up on this so that you avoid using series functions inappropiately (leading to errors and, even worse, incorrect outputs).