Announcement

Collapse
No announcement yet.

signals

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

  • signals

    Alexis C. Montenegro

    I hope I'm doing this right and not violating any protocols. I'm relatively new to computers and online investing and know nothing about programing, strings, threads, etc., but I've seen how much you've helped others and I could really use your help.

    I am using eSignal and use the Basic Studies, Moving Average Section and have set up 2 different EMA's and or SMA's that I use for preliminary buy and sell signals.

    Would you be so kind as to write a program that signals when a SMA or EMA touches or crosses up or down over a secondary SMA or EMA, with different signal sounds and screen shots, and with the ability for us to change the numbers of each SMA or EMA. Also with the ability to have each SMA or EMA with Open or High or Low or Close or O/H/L/C/4.

    If you would do that them please tell me how to download this to the Formulas Section (or any other info that would be needed to download) in eSignal.

    Thank you ahead of time,

    From a Neophyte
    Clayton L. Egeness

  • #2
    Here is what you need. Please let me know how it works.

    EMET

    PHP Code:
    /*
    I hope I'm doing this right and not violating any protocols. I'm relatively new
    to computers and online investing and know nothing about programing, strings, threads,
    etc., but I've seen how much you've helped others and I could really use your help.

    I am using eSignal and use the Basic Studies, Moving Average Section and have set
    up 2 different EMA's and or SMA's that I use for preliminary buy and sell signals.

    Would you be so kind as to write a program that signals when a SMA or EMA touches or
    crosses up or down over a secondary SMA or EMA, with different signal sounds and screen
    shots, and with the ability for us to change the numbers of each SMA or EMA. Also with
    the ability to have each SMA or EMA with Open or High or Low or Close or O/H/L/C/4.

    If you would do that them please tell me how to download this to the Formulas Section
    (or any other info that would be needed to download) in eSignal.
    */


    var fpArray = new Array();


    function 
    preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Signal MA");
        
    setCursorLabelName("MA1");
        
    setCursorLabelName("MA2");
        
    setCursorLabelName("Signal_Line");
        
    setDefaultBarStyle(PS_SOLID);

        
    setDefaultBarFgColor(Color.green0);
        
    setDefaultBarFgColor(Color.blue1);
        
    setDefaultBarFgColor(Color.blue2);


        
    setDefaultBarThickness(10); 
        
    setDefaultBarThickness(11);     
        
    setDefaultBarThickness(32);     
        
        
        
    setPlotType(PLOTTYPE_LINE0);
        
    setPlotType(PLOTTYPE_LINE1);
        
    setPlotType(PLOTTYPE_DOT2);    

        
        
    askForInput();
        
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("Length_MA1"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setName("Main MA Length");
            
    setLowerLimit(1);        
            
    setDefault(20);
        }
        
    fpArray[x] = new FunctionParameter("Length_MA2"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setName("Secondary MA Length");
            
    setLowerLimit(1);        
            
    setDefault(40);
        }
        
        
    fpArray[x] = new FunctionParameter("MainLine"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setName("Main MA ");
            
    addOption("sma");
            
    addOption("ema");
            
    addOption("wma");
            
    addOption("vwma");
            
    setDefault("sma");
        }    
        
    fpArray[x] = new FunctionParameter("SecondaryLine"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setName("Secondary MA ");
            
    addOption("sma");
            
    addOption("ema");
            
    addOption("wma");
            
    addOption("vwma");
            
    setDefault("sma");
        }    
        
    fpArray[x] = new FunctionParameter("Source"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    addOption("open"); 
            
    addOption("high");
            
    addOption("low");
            
    addOption("close");
            
    addOption("hl2");
            
    addOption("hlc3");
            
    addOption("ohlc4"); 
            
    setDefault("ohlc4"); 
        }
        
    fpArray[x] = new FunctionParameter("SignalSoundUP"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }    
        
    fpArray[x] = new FunctionParameter("SignalSoundDOWN"FunctionParameter.STRING);
        
    with(fpArray[x++]){
            
    setDefault();
        }    
     
    }

    var 
    bInit false;
    var 
    ma1 null;
    var 
    ma2 null;
    var 
    FlagDOWN false;

    function 
    main(MainLineLength_MA1SecondaryLineLength_MA2SourceSignalSoundUPSignalSoundDOWN) {
    var 
    ma1Valma2Val;
    var 
    prevma1Valprevma2Val;
    var 
    SignalLine;
    var 
    SymbolInterval;

      if (
    bInit == false) {
       if(
    Symbol == nullSymbol getSymbol();
       if(
    Interval == nullInterval getInterval();
       var 
    vSymbol Symbol+","+Interval;
       
    ma1 = eval(MainLine)(Length_MA1, eval(Source)(sym(vSymbol)));
       
    ma2 = eval(SecondaryLine)(Length_MA2, eval(Source)(sym(vSymbol)));
       
    bInit true;
      }

        
    ma1Val ma1.getValue(0);
        
    ma2Val ma2.getValue(0);
        
        
    prevma1Val ma1.getValue(-1);
        
    prevma2Val ma2.getValue(-1);
        
        
       
       if (
    ma1Val ma2Val && prevma1Val prevma2Val) {
        if(
    SignalSoundUP != null) {
          
    Alert.playSound(SignalSoundUP);
        }
        
    Alert.addToList(getSymbol(), "MA1("+Length_MA1+") crossover MA2("+Length_MA2+") UP "Color.blackColor.grey );     
        
    setDefaultBarFgColor(Color.blue2);
        
    SignalLine ma2Val;
        }    

       if (
    ma1Val ma2Val && prevma1Val prevma2Val) {
        if(
    SignalSoundUP != null) {
          
    Alert.playSound(SignalSoundDONW);
        }
        
    Alert.addToList(getSymbol(), "MA1("+Length_MA1+") crossover MA2("+Length_MA2+") DOWN "Color.whiteColor.black );     
        
    setDefaultBarFgColor(Color.red2);
        
    SignalLine ma2Val;
        }    


       return new Array (
    ma1Valma2ValSignalLine);

    Comment


    • #3
      signals

      emet,

      And from out of the desert I came and succeeded in copying your beautifully written code to the Flormulas Section.

      I did it ... I did it ... I did it! Thank you!

      Can you please make the following changes:

      1) Main MA. Needs a Source Available. Open - High - Low - Close - OHLC/4 like the Secondary MA has.

      2) Need to set different colors, line thickness and solid, dotted, etc. for each Main MA and each Secondary MA so they can easily be determined which is which on the charts.

      3) The Pop Up Alert comes up perfectly but for some reason I cannot access the Sound Alert. I've checked all the settings and they work.

      Again being the novice I am this is so exciting for me.

      Thank you again,

      Clayton L. Egeness
      Last edited by egeness; 08-04-2008, 08:18 AM.
      Clayton L. Egeness

      Comment


      • #4
        PHP Code:
        //Developed by EMET
        //Signal MA 

        /*
        I hope I'm doing this right and not violating any protocols. I'm relatively new
        to computers and online investing and know nothing about programing, strings, threads,
        etc., but I've seen how much you've helped others and I could really use your help.

        I am using eSignal and use the Basic Studies, Moving Average Section and have set
        up 2 different EMA's and or SMA's that I use for preliminary buy and sell signals.

        Would you be so kind as to write a program that signals when a SMA or EMA touches or
        crosses up or down over a secondary SMA or EMA, with different signal sounds and screen
        shots, and with the ability for us to change the numbers of each SMA or EMA. Also with
        the ability to have each SMA or EMA with Open or High or Low or Close or O/H/L/C/4.

        If you would do that them please tell me how to download this to the Formulas Section
        (or any other info that would be needed to download) in eSignal.
        */


        var fpArray = new Array();


        function 
        preMain() {
            
        setPriceStudy(true);
            
        setStudyTitle("Signal MA");
            
        setCursorLabelName("MA1");
            
        setCursorLabelName("MA2");
            
        setCursorLabelName("Signal_Line");
            
        setDefaultBarStyle(PS_SOLID);

            
        setDefaultBarFgColor(Color.green0);
            
        setDefaultBarFgColor(Color.blue1);
            
        setDefaultBarFgColor(Color.blue2);


            
        setDefaultBarThickness(10); 
            
        setDefaultBarThickness(11);     
            
        setDefaultBarThickness(32);     
            
            
            
        setPlotType(PLOTTYPE_LINE0);
            
        setPlotType(PLOTTYPE_LINE1);
            
        setPlotType(PLOTTYPE_DOT2);    

            
            
        askForInput();
            
            var 
        x=0;
            
        fpArray[x] = new FunctionParameter("Length_MA1"FunctionParameter.NUMBER);
            
        with(fpArray[x++]){
                
        setName("Main MA Length");
                
        setLowerLimit(1);        
                
        setDefault(20);
            }
            
        fpArray[x] = new FunctionParameter("Length_MA2"FunctionParameter.NUMBER);
            
        with(fpArray[x++]){
                
        setName("Secondary MA Length");
                
        setLowerLimit(1);        
                
        setDefault(40);
            }
            
            
        fpArray[x] = new FunctionParameter("MainLine"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        setName("Main MA ");
                
        addOption("sma");
                
        addOption("ema");
                
        addOption("wma");
                
        addOption("vwma");
                
        setDefault("sma");
            }    
            
        fpArray[x] = new FunctionParameter("SecondaryLine"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        setName("Secondary MA ");
                
        addOption("sma");
                
        addOption("ema");
                
        addOption("wma");
                
        addOption("vwma");
                
        setDefault("sma");
            }    
            
        fpArray[x] = new FunctionParameter("MainSource"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        addOption("open"); 
                
        addOption("high");
                
        addOption("low");
                
        addOption("close");
                
        addOption("hl2");
                
        addOption("hlc3");
                
        addOption("ohlc4"); 
                
        setDefault("ohlc4"); 
            }
            
        fpArray[x] = new FunctionParameter("SecondarySource"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        addOption("open"); 
                
        addOption("high");
                
        addOption("low");
                
        addOption("close");
                
        addOption("hl2");
                
        addOption("hlc3");
                
        addOption("ohlc4"); 
                
        setDefault("ohlc4"); 
            }
            
        fpArray[x] = new FunctionParameter("SignalSoundUP"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        setDefault();
            }    
            
        fpArray[x] = new FunctionParameter("SignalSoundDOWN"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        setDefault();
            }    

            
        fpArray[x] = new FunctionParameter("MainColor"FunctionParameter.COLOR);
            
        with(fpArray[x++]){
               
        setDefault(Color.blue);
            }    
         
            
        fpArray[x] = new FunctionParameter("SecondaryColor"FunctionParameter.COLOR);
            
        with(fpArray[x++]){
               
        setDefault(Color.green);
            }    

            
        fpArray[x] = new FunctionParameter("MainThickness"FunctionParameter.NUMBER);
            
        with(fpArray[x++]){
                
        setLowerLimit(1);        
                
        setDefault(1);
            }

            
        fpArray[x] = new FunctionParameter("SecondaryThickness"FunctionParameter.NUMBER);
            
        with(fpArray[x++]){
                
        setLowerLimit(1);        
                
        setDefault(1);
            }


         
        }

        var 
        bInit false;
        var 
        ma1 null;
        var 
        ma2 null;
        var 
        FlagDOWN false;

        function 
        main(MainLineLength_MA1MainSourceMainColorMainThicknessSecondaryLine,
                     
        Length_MA2SecondarySourceSecondaryColorSecondaryThicknessSignalSoundUPSignalSoundDOWN) {
        var 
        ma1Valma2Val;
        var 
        prevma1Valprevma2Val;
        var 
        SignalLine;
        var 
        SymbolInterval;

          if (
        bInit == false) {
           if(
        Symbol == nullSymbol getSymbol();
           if(
        Interval == nullInterval getInterval();
           var 
        vSymbol Symbol+","+Interval;
           
        ma1 = eval(MainLine)(Length_MA1, eval(MainSource)(sym(vSymbol)));
           
        ma2 = eval(SecondaryLine)(Length_MA2, eval(SecondarySource)(sym(vSymbol)));
            
        setDefaultBarFgColor(MainColor0);
            
        setDefaultBarFgColor(SecondaryColor1);
            
        setDefaultBarThickness(MainThickness0); 
            
        setDefaultBarThickness(SecondaryThickness1);     
           
        bInit true;
          }

            
        ma1Val ma1.getValue(0);
            
        ma2Val ma2.getValue(0);
            
            
        prevma1Val ma1.getValue(-1);
            
        prevma2Val ma2.getValue(-1);
            
            
           
           if (
        ma1Val ma2Val && prevma1Val prevma2Val) {
            if(
        SignalSoundUP != null) {
              
        Alert.playSound(SignalSoundUP);
            }
            
        Alert.addToList(getSymbol(), "MA1("+Length_MA1+") crossover MA2("+Length_MA2+") UP "Color.blackColor.grey );     
            
        setDefaultBarFgColor(Color.blue2);
            
        SignalLine ma2Val;
            }    

           if (
        ma1Val ma2Val && prevma1Val prevma2Val) {
            if(
        SignalSoundUP != null) {
              
        Alert.playSound(SignalSoundDONW);
            }
            
        Alert.addToList(getSymbol(), "MA1("+Length_MA1+") crossover MA2("+Length_MA2+") DOWN "Color.whiteColor.black );     
            
        setDefaultBarFgColor(Color.red2);
            
        SignalLine ma2Val;
            }    


           return new Array (
        ma1Valma2ValSignalLine);

        EMET

        Comment


        • #5
          signals

          emet,

          You're amazing. Thank you ... Thank you ... Thank you. Everything works exactly as I have asked for including the pop up alert. The only problem is there is no sound alert.

          I contacted eSignal tech support and they said I have to go back to the originator of the code for this.

          How do I make the sound alert work?

          Clayton L. Egeness
          Clayton L. Egeness

          Comment


          • #6
            In parameters SignalSoundDOWN, SignalSoundUP, specify the path to the audio files. Example: C: \ mysound.wav

            Comment


            • #7
              signals

              emet,

              I'm sorry I sound so dense, but I'm new to all this. I don't know how to specify the path to the audio files.

              Also on line 162 - Alert.playSound (SignalSoundDONW); Should that be DOWN?

              Would you be so kind as to lead me step by simple step on how to specify the path to the audio files so the sound can be activated.

              Thank you again.
              Last edited by egeness; 08-05-2008, 10:28 AM.
              Clayton L. Egeness

              Comment


              • #8
                Click the right button mouse on schedule. Choose Edit Studies and specify in the options SignalSoundDONW and SignalSoundUP path of sound file. Example: C:\WINDOWS\Media\tada.wav

                Comment


                • #9
                  signals

                  emet,

                  What a fantastic learning experience I have just gone through with you.

                  May the great Coding Buddha send you 1,000 Thank You's from me.

                  I did have to make 1 correction before it all worked. See attachment to show error.

                  In C:\Program Files\eSignal\Formulas\Signals\eSignalFormula1.efs I changed DONW to DOWN to make it work.

                  I did not change it in you original coding page.

                  Thank you again.

                  An after thought ? Why wouldn't the sound work with the following:

                  C:\Program Files\eSignal\Sounds\Down.wav
                  Last edited by egeness; 08-06-2008, 11:11 AM.
                  Clayton L. Egeness

                  Comment


                  • #10
                    You correctly done replacing DONW -> DOWN, this is my mistake.

                    Sound files can be anything *.wav, including your preferred if it exists. Example for existing files:
                    C:\Program Files\eSignal\Sounds\buzz.wav
                    and
                    C:\Program Files\eSignal\Sounds\ding.wav


                    I hope this script helped you .

                    Comment


                    • #11
                      signals

                      emet,

                      Once again, Thank you. My education is ongoing and you have helped tremendously.
                      Clayton L. Egeness

                      Comment

                      Working...
                      X