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

Postby shivax » 13 Feb 2018

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?

User avatar
TJ
Posts: 6890
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1979 times

Re: Problem to code it

Postby TJ » 13 Feb 2018

shivax wrote: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

Postby shivax » 13 Feb 2018

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

Postby shivax » 15 Feb 2018

this is the error

but if i set Avg=0 it does not do the rest of the code
Attachments
immagine.png
immagine.png (10.36 KiB) Viewed 312 times

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

Re: Problem to code it

Postby shivax » 19 Feb 2018

someone help me? thank

User avatar
TJ
Posts: 6890
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1979 times

Re: Problem to code it

Postby TJ » 19 Feb 2018

shivax wrote:someone help me? thank



Please read the second sentence in the 2nd post.

User avatar
TJ
Posts: 6890
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 984 times
Been thanked: 1979 times

Re: Problem to code it

Postby TJ » 20 Feb 2018


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

Re: Problem to code it

Postby shivax » 21 Feb 2018

TJ wrote:
shivax wrote: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
Immagine1.png (27.46 KiB) Viewed 244 times


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: 407
Joined: 21 Apr 2013
Has thanked: 102 times
Been thanked: 61 times

Re: Problem to code it

Postby wilkinsw » 21 Feb 2018

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).


Return to “MultiCharts”