General Topics
Markets
Technical Topics
Brokerage Firms
Company Specific
Community Lounge
Site Support

# Strategy building in TS2000

Discussion in 'Strategy Building' started by scouse, Oct 20, 2002.

1. ### scouse

I am building a strategy in easylanguage and have hit a problem, can anybody tell me if it is possible to transfer the value of a variable from one indicator to another and have two indicators using the same variable.

If this is possible I would be very greatfull if someone would explain how.

Scouse

2. ### metooxx

Yes; but I haven't done it in years.

If not get in touch with me and I will get you the email address of someone else who can for sure.

3. ### Mechanical Method

Pick a name for a variable.
var: myVariable(0);

Set the variable equal to your indicator.
myVariable=myIndicator;

If your indicator is average(c,5) that part looks like this.
myVariable=average(c,5);

To call your indicator within a second indicator use it's name in the place you normally see close price. If your second indicator is an average of your first indicator it's...
average(myVariable,5)

That gives you a double smoothed average or a 5 period average of a 5 period average.

If your second indicator needs a name you will need 2 variables.
var: myVariable(0), indicator2(0);
myVariable=average(c,5);
indicator2=average(myVariable,5);

You can name them indicator1 and indicator2 or anything that makes it easier to follow. You can use numbers within variable names as long as it's not as the first character.
var: indicator1(0), indicator2(0);
indicator1=average(c,5);
indicator2=average(indicator1,5);

4. ### scouse

Thanks Mechanical Method for your help.

Once I have brought the other indicator into my program is it possible to bring the value of a variable in from that indicator, that is what I am trying to do. I don't think my explanation was very clear, is this possible?

Thanks again

Mark

5. ### Mechanical Method

If you write a new indicator that includes the code from both of the other indicators then their values can be passed back and forth between them.

6. ### scouse

Hi Mechanical Method

How do you reference the variables from one to another. I tried what you said in an earlier post, but it saw the indicator name as just another variable.

Scouse

7. ### Mechanical Method

It's easy if you combine both indicators within 1 new indicator. Then the variable list in the new indicator contains all the variables from both indicators.

8. ### scouse

Hi

They need to be kept seperate because there are bits of the code which are different. The first indicator is for entry and the second is for exit and both are on different time frames.

Is there any other way?

Scouse

9. ### Mechanical Method

Probably but it's beyond my abilities.

10. ### Mechanical Method

You can combine the entry and exit into 1 strategy even though they're using different ideas. That's not a problem.

There's several ways to solve the multiple timeframe thing. The easiest is load the same symbol in the higher timeframe into the same chart and reference it as data2. Then you can share the results from different time frames.

You reference data1 the same as always.
average(c,5);

You reference data2 which is the higher timeframe like this.
average(c data2,5);

#10     Oct 21, 2002
ET IS FREE FOR TRADERS BECAUSE OF THE FINANCIAL SUPPORT FROM THESE SPONSORS: