If not(X) then return;

Questions about MultiCharts and user contributed studies.
turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 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: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 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: 742
Joined: 09 Apr 2010
Location: Texas
Has thanked: 483 times
Been thanked: 274 times
Contact:

Re: If not(X) then return;

Postby sptrader » 07 Jun 2018

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

turbofib
Posts: 213
Joined: 11 May 2013
Has thanked: 67 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: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 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: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 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: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 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”