Announcement

Collapse
No announcement yet.

How do you apply indicators to indicators?

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

  • How do you apply indicators to indicators?

    I set up a ratio, which is basically RATIO = Symbol1 = Symbol2.
    I now want to apply a Bollinger Band to that ratio (which is plotted in an indicator panel).

    any code examples on how to do this?

    tia, asher.

  • #2
    sorry, i meant RATIO = SYMBOL1 / SYMBOL2.

    Comment


    • #3
      asherisaac
      Click here and download BBof_template.efs.
      You can use this as a base to create the study you want
      Alex

      Comment


      • #4
        alex...i'm not quite seeing how to apply the problem in my code. here are some lines of code...i just need to draw a bollinger band or apply a moving around to the RATIO value, which gets plotted in the indicator window.


        function preMain() {

        setStudyTitle("AID_PAIR_TRADER");
        setCursorLabelName("UPPER", 1);
        setCursorLabelName("AID_PAIR_TRADER");
        setCursorLabelName("AID_PAIR_TRADER");

        }



        function main(s1, s2) {

        var BOLLY = new BollingerStudy(40, "Close", 2);
        var UPPER = BOLLY.getValue(BollingerStudy.UPPER);
        var LOWER = BOLLY.getValue(BollingerStudy.LOWER);
        var BASIS = BOLLY.getValue(BollingerStudy.BASIS);
        var Sym1 = getValue("Open", 0, 1, s1);
        var Sym2 = getValue("Open", 0, 1, s2);
        var RATIO = Sym1 / Sym2;


        if ((UPPER == null) || (LOWER == null) || (BASIS == null)) {

        return; }


        if (s1 == null) {

        s1 = "SPY";

        }

        if (s2 == null) {

        s2 = "QQQ";

        }





        return(RATIO);

        }

        Comment


        • #5
          asherisaac
          You cannot use a builtin study with a symbol other than the one being charted in the price window. If you are charting the ratio SPY /QQQ in the main window as your price series then all you need to do is set the bultin Bollinger study to plot as an indicator (ie setPriceStudy(false);) othewise you need to create your own Bollinger study which is where BBof_template.efs will be of use.
          Alex

          Comment


          • #6
            alex, how would i chart the ratio of SPY/QQQ in the main window?
            right now i've successfully charted SPY/QQQ in an indicator panel...there's no way to just apply a bollinger band or moving average to this plot in the indicator panel?

            Comment


            • #7
              asherisaac

              how would i chart the ratio of SPY/QQQ in the main window?

              As you would with a regular symbol ie type SPY / QQQ (note that there must be a space before the operator sign).

              there's no way to just apply a bollinger band or moving average to this plot in the indicator panel?

              Not with the builtin Bollinger Band or Moving Average studies
              Alex

              Comment


              • #8
                thanks, alex.
                if i have the main window set to SPY / QQQ, and an EFS script running off it generating trade signals, how can i tell optionsxpress to simultaneously buy SPY and sell QQQ or vice versa? (pairs trading). is anybody doing pairs trading successfully with esignal?

                Comment

                Working...
                X