If not(X) then return;

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 162
Joined: 11 May 2013
Has thanked: 48 times
Been thanked: 1 time

If not(X) then return;

Postby turbofib » 07 Jun 2018

hi

Is it possible to use an output condition without using if then?

(in c# it's : If not(X) then return )

User avatar
TJ
Posts: 7235
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2058 times

Re: If not(X) then return;

Postby TJ » 07 Jun 2018

hi

Is it possible to use an output condition without using if then?

(in c# it's : If not(X) then return )

Please explain with an example.

sptrader
Posts: 710
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 470 times
Been thanked: 261 times
Contact:

Re: If not(X) then return;

Postby sptrader » 07 Jun 2018

Maybe something like: IFF( C>O,1,-1);

turbofib
Posts: 162
Joined: 11 May 2013
Has thanked: 48 times
Been thanked: 1 time

Re: If not(X) then return;

Postby turbofib » 07 Jun 2018

Example :
In MultiChart :

if Date>1081101 then begin

all code....

end;

i would this:

if Date<=1081101 then exit

(it does not go on ... you stop there)

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1503 times
Contact:

Re: If not(X) then return;

Postby JoshM » 11 Jun 2018

Is it possible to use an output condition without using if then?

(in c# it's : If not(X) then return )
It's not possible as far as I know to prematurely terminate the script calculation for a particular price update. (It would be helpful if we could, so I hope I'm mistaken here. :) )

You can of course put it in a big if statement (if X then ...). Placing your code in a function is another option, because functions can exit earlier with the `return` keyword.

User avatar
ABC
Posts: 636
Joined: 16 Dec 2006
Has thanked: 120 times
Been thanked: 359 times
Contact:

Re: If not(X) then return;

Postby ABC » 11 Jun 2018

JoshM,

you can use the #return statement to accomplish that.

Code: Select all

Print( "A CurrentBar = ", CurrentBar ) ;

if CurrentBar < 100 then
#return ;

Print( "B CurrentBar = ", CurrentBar ) ;
The print starting with B will only start to appear with bar 100 in the output.

Regards,

ABC

Is it possible to use an output condition without using if then?

(in c# it's : If not(X) then return )
It's not possible as far as I know to prematurely terminate the script calculation for a particular price update. (It would be helpful if we could, so I hope I'm mistaken here. :) )

You can of course put it in a big if statement (if X then ...). Placing your code in a function is another option, because functions can exit earlier with the `return` keyword.

User avatar
ABC
Posts: 636
Joined: 16 Dec 2006
Has thanked: 120 times
Been thanked: 359 times
Contact:

Re: If not(X) then return;

Postby ABC » 11 Jun 2018

turbofib,

take a look at the build in --- Market Depth on Chart --- indicator as it demonstrates different ways of flow control within an indicator.

Regards,

ABC
hi

Is it possible to use an output condition without using if then?

(in c# it's : If not(X) then return )


Return to “MultiCharts”