Announcement

Collapse
No announcement yet.

Price Alert

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

  • Price Alert

    Trying to write a efs so I can manually enter price information for alerts. Why doesn't Source1 & 2 work ? When I hard code Source1 with high() - EntryPrice > .0010 the alert fires continually at any price > than entry and seems to ignore the .0010. When I use Source1 - EntryPrice > .0010 I get no alert.

    I'm running this on EUR AO-FX with a current price of 1.2808

    PHP Code:
    function preMain() {

        
    setPriceStudy(true);
        
    setStudyTitle("Price_Alert");
        
    setCursorLabelName("Price_AL"0);
        
        
        var 
    fp1 = new FunctionParameter("Source1"FunctionParameter.STRING);
        
        
    fp1.addOption("Close");
        
    fp1.addOption("High");
        
    fp1.addOption("Low");
        
    fp1.addOption("Open"); 
        
    fp1.addOption("HL/2");
        
    fp1.addOption("HLC/3");
        
    fp1.addOption("OHLC/4"); 
        
    fp1.setDefault("High");
            
        var 
    fp2 = new FunctionParameter("Source2"FunctionParameter.STRING);
        
        
    fp2.addOption("Close");
        
    fp2.addOption("High");
        
    fp2.addOption("Low");
        
    fp2.addOption("Open"); 
        
    fp2.addOption("HL/2");
        
    fp2.addOption("HLC/3");
        
    fp2.addOption("OHLC/4"); 
        
    fp2.setDefault("Low");
            
        var 
    fp3 = new FunctionParameter("Length"FunctionParameter.NUMBER);
        
    fp3.setName("Length");
        
    fp3.setLowerLimit(1);        
        
    fp3.setDefault(5);
        
        var 
    fp4 = new FunctionParameter("EntryPrice"FunctionParameter.NUMBER);
        
    fp4.setName("EntryPrice");
        
    fp4.setLowerLimit(1);        
        
    fp4.setDefault(1000);
        
        var 
    fp5 = new FunctionParameter("Toggle"FunctionParameter.STRING);//PreTrade Alerts on or off
        
    fp5.setName("Alerts On/Off");
        
    fp5.addOption("On");
        
    fp5.addOption("Off");
        
    fp5.setDefault("Off");
        
        }
            
                    
        function 
    main(Source1Source2LengthEntryPriceToggle) {
        
        
            if (
    Toggle != "Off"){
            
                if (
    Source1 EntryPrice .0010) {
                    
    Alert.addToList(getSymbol(), "Price is > Entry"Color.blackColor.blue);
                    
    Alert.playSound("Buzz.wav");
            
            }else {
            
                if (
    EntryPrice Source2 .0010) {
                    
    Alert.addToList(getSymbol(), "Price is > Entry"Color.blackColor.red);
                    
    Alert.playSound("Buzz.wav");
                    
            }}}
        

        return;


    Last edited by huntergatherer; 08-19-2010, 05:32 PM.

  • #2
    Found my () equation problem for the > calculation. Duh!!

    For the Source1 & 2 problem I will be running this on 60 min charts but want the alert to fire quicker using high(inv(5)) etc.

    Only way I can figure is to hard code it without using the FunctionParameter for a selection of low, high, hl/2 etc. unless anyone has a suggestion. Thanks!

    Comment

    Working...
    X