Strategy building in TS2000

Discussion in 'Strategy Development' 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.

    Thanks in adavnce

    Scouse :confused:
  2. Yes; but I haven't done it in years.

    PM Nitro; I am pretty sure he can help you.

    If not get in touch with me and I will get you the email address of someone else who can for sure.
  3. Pick a name for a variable.
    var: myVariable(0);

    Set the variable equal to your indicator.

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

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

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

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

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

    Your help is much appreciated.

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



    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?

    Thanks for your time
  9. Probably but it's beyond my abilities.
  10. 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.

    You reference data2 which is the higher timeframe like this.
    average(c data2,5);
    #10     Oct 21, 2002