Announcement

Collapse
No announcement yet.

important question...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • important question...

    i think i am not the only one who has got this problem.
    here it is:

    If i have a formula which is called to callculate if the chart will go up or down i try to return 1 & -1 but here is the problem... when you want to see the indicator with normal lines to change it ( right click - edit studies) you have got 2 formulas... and you have to do the changes in both of the formulas...

    as example you have got
    1 stochrsi - which returns lines and backgroundcolor red // green
    2 stochrsi-call - it only returns 1 & -1

    is there a way that the vars in both formulas get changed at the same time ?! (right click - edit studies - e.g. lengh 10)

    please help me
    regards erilein

  • #2
    i think i am not the only one who has got this problem.

    I think you might be, but let's see what can be done.

    You will probably have to post your efs files, but here is what I would do.

    First, I would consider merging the two efs files into one. Impossible to explain how to do this in detail, but basically you do the math for each indicator inside one efs, not in two efs. Just

    return new Array(efs1Var1, efs1Var2, efs2Var1, efs2Var2);

    after you finish the math for the variable you use.

    The other way is to not return anything from the 2nd efs and use

    setGlobalValue( varname, value ) ie

    setGlobalValue( varname1, -1)
    setGlobalValue( varname2, +1)

    then in efs1

    getGlobalValue( varname ) ie

    getGlobalValue( varname1)
    getGlobalValue( varname2)

    and then

    return new Array(efs1Var1, efs1Var2, varname1, varname2);

    Comment


    • #3
      ok what i understand is that i should put the 2 formulas in one...

      i thought about an example and here it is:

      Stoch

      PHP Code:
      var vStoch14_1 = new StochStudy(1413);

      function 
      preMain() {
          
      setPriceStudy(false);
          
      setStudyTitle("stoch");
          
      setCursorLabelName("1"0);
          
      setCursorLabelName("2"1);
          
      setDefaultBarStyle(PS_SOLID0);
          
      setDefaultBarStyle(PS_SOLID1);
          
      setDefaultBarFgColor(Color.red0);
          
      setDefaultBarFgColor(Color.blue1);
          
      setDefaultBarThickness(10);
          
      setDefaultBarThickness(11);
          
      setPlotType(PLOTTYPE_LINE0);
          
      setPlotType(PLOTTYPE_LINE1);
      }

      function 
      main() {


              if (
      vStoch14_1.getValue(StochStudy.FAST) > vStoch14_1.getValue(StochStudy.SLOW))setBarBgColor(Color.RGB(255,0,0));

          return new Array(
              
      vStoch14_1.getValue(StochStudy.FAST),
              
      vStoch14_1.getValue(StochStudy.SLOW)
          );


      Stoch-Call
      PHP Code:
      var vStoch14_1 = new StochStudy(1413);
      var 
      0;
      function 
      preMain() {
          
      setPriceStudy(false);
          
      setStudyTitle("stoch");
      }

      function 
      main() {


              if (
      vStoch14_1.getValue(StochStudy.FAST) > vStoch14_1.getValue(StochStudy.SLOW))= -1;

          return 
      a;

      i dont know how to get them in one efs file...

      thank you and regards ... erilein

      Comment


      • #4
        Re: Reply to post 'important question...'

        //Assuming the original 2 did what you want, this does the same in one efs
        //can you see what I did?

        var vStoch14_1 = new StochStudy(14, 1, 3);
        var a = 0;//added

        function preMain() {
        setPriceStudy(false);
        setStudyTitle("stoch");
        setCursorLabelName("1", 0);
        setCursorLabelName("2", 1);
        setCursorLabelName("2", 2);//added
        setDefaultBarStyle(PS_SOLID, 0);
        setDefaultBarStyle(PS_SOLID, 1);
        setDefaultBarStyle(PS_SOLID, 2);//added
        setDefaultBarFgColor(Color.red, 0);
        setDefaultBarFgColor(Color.blue, 1);
        setDefaultBarFgColor(Color.lime, 2);//added
        setDefaultBarThickness(1, 0);
        setDefaultBarThickness(1, 1);
        setDefaultBarThickness(1, 2);/added
        setPlotType(PLOTTYPE_LINE, 0);
        setPlotType(PLOTTYPE_LINE, 1);
        setPlotType(PLOTTYPE_LINE, 2);//added
        }

        function main() {


        if (vStoch14_1.getValue(StochStudy.FAST) >
        vStoch14_1.getValue(StochStudy.SLOW)){ //added {
        setBarBgColor(Color.RGB(255,0,0));
        a = -1;/added
        }//added }

        return new Array(
        vStoch14_1.getValue(StochStudy.FAST),
        vStoch14_1.getValue(StochStudy.SLOW),
        a//added
        );

        }

        /*********************** All this stuff is the second efs - commented out

        var vStoch14_1 = new StochStudy(14, 1, 3);
        var a = 0;
        function preMain() {
        setPriceStudy(false);
        setStudyTitle("stoch");
        }

        function main() {


        if (vStoch14_1.getValue(StochStudy.FAST) >
        vStoch14_1.getValue(StochStudy.SLOW))a = -1;

        return a;
        }


        */
        // this is the end of the efs

        Comment

        Working...
        X