Home                           

 Try Investor/RT             

 Investor/RT Tour           

 Getting Started              

 What's New                  

 Testimonials                 

Search . . .

 Pricing Summary

 Place Your Order

 Product Description

 Sales Center           

 Contact Us            

 Referrals              

 Renewals            

 Customer Support     

 Download Center      

 Videos        

 Documentation        

 Q & A                      

 Tip Of The Day        

 Tutorials                  

 Advanced Profiling

 Trading Systems    

 Scans                  

 Voices                  

 Education & Training

 Upgrade Center      

 Discussion List         

 Investor/RT Chat       

 About Linn Software

 User Exchange        

 Search

Investor/RT
Voices
Dan Tillemans

An excerpt from an email from Arnie to the LinnSoft Yahoo Group on 03/19/08

Bookmark this site and study it for syntax:
http://www.linnsoft.com/tour/scanOperElem.htm
 
Also this site:
http://www.linnsoft.com/tour/scanElems.htm

I think these sites should provide the necessary tools to write the formulas you have outlined below, which I am pretty sure will be possible.

Attached are two Word documents that I saved from a while back that I found useful in working with IRT syntax. One of these was written by a Frenchman named "Eddy" who made some great contributions to the list. The other is from IRT help.

In addition to this, I have found the use of V#s to be tremendously useful in formulas. A V# will store any number you set it to, and will remain linked to a specific instrument. You can then use that V# to represent a specific value in any formula. For example, if you want to change one value in a formula without going into the formula (or have IRT set the V# to change that value throughout your system) this is a great approach. Some specific formulas to look at :

IF (V#99=1) THEN (MACD*V#100);

IF (V#99=2) THEN (MACD*V#100);

These are formulas for two different custom indicators contained in the same chart. Maybe the first one is red and the second one is green, and you want only one to display at a time... and only under certain conditions. In this case V#99 is the "on-off" switch and V#100 reduces the MACD by a specific amount, let's say increments of .10 that you can adjust.

You can write a signal formula to have IRT control all of this from behind the scenes (using signal markers in charts or running these same formulas in a Custom Column), or you can use the formulas in combination with a button to make the adjustments with mouse clicks.

Here is a formula to set V#99 to "1":
SET(V#99,1);

Here is a formula to toggle on-off the " V#99=1" formula:
SET(V#99,(V#99=0)?1:0);
It says " If V#99 is equal to zero then set V#99 to 1, otherwise set it to zero".

Here is a toggle formula that will set V#99 to go from no CI displayed in the chart, to the red one, then the green one, and then back to nothing.
SET(V#99,(V#99=2)?0:(V#99+1));

This formula will adjust the value of V#100 upward in .10 increments:
SET(V#100,(V#100+.10));

This formula will adjust it downward, but will stop at "0"
SET(V#100,(V#100>0)?(V#100-.10): 0);

The semicolon ";" is used to separate each line of a formula, so it is possible to set a lot of V#s along the way to the last line of the formula. IRT will only display the last line of the formula for a custom indicator, but will perform all of the V# setting prior to this also.

I sent a post to the list on 3/6 that goes into this type of thing in more detail.

You can also create a column in a quote page and type in the value for a V# for an instrument... or go there to find out what the number is actually set to right now. It is also possible to use annotation to display the value right on the chart next to the indicator.

Hope you can make some progress with the custom indicator formulas. IRT is a tremendously powerful and flexible program once you can see how to use it. And it will do a lot of things other programs are not able to do. It is definitely worth spending some time working with. I have copies of TradeStation and Metastock that I have not used for years, and will not go back to.

Hope this information is of some help...

Dan Tillemans


Eddy’s Syntax Lesson

=================================================================

Let's start with a quick reminder of the difference between a custom indicator and a signal:
Basically, a custom indicator (CI) returns an arithmetical value
(like 2.37)
While a signal returns a Boolean value, i.e. either true (value 1) or false (value 0)

1) Why is an "AND" statement (in a signal) equivalent to a
multiplication inside a CI ?

Lets consider the following example

TIME > 1530 and TIME < 1630

This trading signal will only return true if both tests return true.

You need to know that if a custom indicator includes some logical
comparison (like A>B), then it will use the actual value for
this Boolean expression: either 1 (if the expression returns true) or
0 (if false)

So lets write a custom indicator like

CI = (TIME > 1530)*(TIME < 1630)

This custom indicator is the multiplication of two Boolean
expressions which are either equal to 0 or 1

If time = 1730 then CI = 1 x 0 = 0 (first test is true / second is
false)
If time = 1430 then CI = 0 x 1 = 0

But if time = 1600 then CI = 1 x 1 = 1

So now, you see that a trading signal which is written like CI > 0,
ie :
(TIME > 1530)*(TIME < 1630) > 0

is strictly equivalent to the following trading signal syntax :

TIME > 1530 and TIME < 1630

The AND, which is there to make sure that both statements are true, is infact simulated by a multiplication.

Note : you may add several conditions in a row, for example :
(A>B)*(C>D)*(E>F)*(G>H) > 0

For (A>B)*(C>D)*(E>F)*(G>H) to be positive, you need to have the 4
following statements returning true, ie having simultaneously
(A>B) and (C>D) and (E>F) and (G>H)
Otherwise, if one of these 4 expressions returns false (ie zero),
then the whole expression will be equal to zero, ie the signal will
return false...

2) WHY is "OR" equivalent to an addition

OK, let’s show how the OR is equivalent to an addition

Lets say my trading signal is TIME < 1430 or TIME >1530

This can be simulated by CI > 0 with

CI = (TIME<1430) + (TIME >1530)

Ie CI will be positive if at least ONE of the two statement is true
(ie returns a value of 1)

Of course, one may mix both AND and OR statements :

(TIME > 1530 and TIME < 1630) or (TIME > 2030 and TIME < 2130)

is equivalent to the trading signal

( (TIME > 1530)*(TIME < 1630) + (TIME > 2030)*(TIME < 2130) ) > 0

3) IF THEN ELSE statement

Let's consider following IF THEN ELSE statement, which is used to
determine the value of a V# variable :

IF A > B then SET(V#1,C) Else SET(V#1,D)

In fact, this can be represented by two successive "IF THEN"
conditions :

IF A > B then V#1 = C
IF A <= B then V#1 = D

Or, using the custom indicator way, simply as :

V#1 = (A>B)*C + (A<=B)*D

Indeed, lets say A is higher than B, then
A>B returns 1 and A<=B returns 0
so V#1 = 1*C + 0 * D = C

otherwise, if A is less or equal to B, then
A>B returns 0 and A<=B returns 1
so V#1 = 0*C + 1 * D = D

Conclusion :

the expression
IF A > B then SET(V#1,C) Else SET(V#1,D)

is stricly equivalent to

SET(V#1, (A>B)*C + (A<=B)*D )

I would then recommend to use
SET(V#1,CI) with CI=(A>B)*C + (A<=B)*D

This way, if you want to test various V#1 formula, you just need to
pick up a new CI within you CI library, which will be "quicker" than
changing all elements inside a IF THEN ELSE statement...

What is nice with such an approach is that you may "embed" as many IF
THEN ELSE statement as possible, ie in above CI formula, A itself
could be the result of another IF THEN ELSE statement, ie

A= CI_bis = (E>F)*G + (E<=F)*H

Eddy

IRT Syntax Lesson on Nesting

SET(T#22,V#1>0?"a":(V#2>0?"b":"c"));

In general, anywhere you want a numeric expression in RTL you can use a formulation of the form:

<conditional expression> ? <expressionA> : <expressionB>

where <conditional expression> is any RTL expression that can be evaluated as true or false, and the two alternative expressions are of arbitrary complexity. Unlike IF THEN ELSE, conditional expressions formed with ? and : can be nested. Be sure to use appropriate parentheses to guide the proper evaluation of more complex expressions. Here is an example of a nested conditional:

CL > OP ? MAX(CL,5) : ( CL < MID ? MIN(CL,5) : MIN(CL,3) )

This formula will compute the value of the indicator as MAX (CL,5) for each bar where CL > OP. For bars that close at or below the open, a second conditional evaluation occurs. For those bars, when the close is below the MID (the midpoint of the high-low range) the indicator result is MIN(CL,5), but closes above the midpoint of the range get MIN(CL,3).The entire expression above could be put into a scan that sets the value of a V# variable, i.e.

SET(V#33, CL > OP ? MAX(CL,5) : ( CL < MID ? MIN(CL,5) : MIN(CL,3) ) )

When formulating complex, possibly nested expressions such as this, use the "Check" button in the RTL setup window to review the evaluation steps Investor/RT will use when processing your formula. For the example above you will see something like this:

Parsing: CL > OP ? MAX(CL,5) : (CL < MID ? MIN(CL,5) : MIN(CL,3))
#1. Evaluate: T1=CL > OP
#2. Evaluate: T2=MAX(CL, 5)
#3. Evaluate: T3=CL < MID
#4. Evaluate: T4=MIN(CL, 5)
#5. Evaluate: T5=MIN(CL, 3)
#6. Evaluate: T6=T4 : T5
#7. Evaluate: T7=T3 ? T6
#8. Evaluate: T8=T2 : T7
#9. Result is: T9=T1 ? T8