Announcement

Collapse
No announcement yet.

Placing Automated Orders with URLS

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

  • Placing Automated Orders with URLS

    Hi there folks,
    I have the capability to place orders automatically to my dealer using URL's. If my EFS script determines that it's time to place an order...I can do so using something that looks like...

    if (isLastBarOnChart( )){

    //now place order to dealing station

    @URL=http:://dealer.com/services/auto.asmx/[email protected]&PWD=chris&Pa ir=GBP/USD&BuySell=B&Amount=200000

    }

    I've been messing with this for awhile without much success. The problem seems to be illegal charachters...and I'm not sure which one nor how to "escape" them. Characters in question are "&", "?" and perhaps the "/".

    Next question is in calling it...Would i just use @URL=http://...etc. as I'm doing?

    Thanks !

  • #2
    Hello Chris,

    I have an idea for this. But it won't be an automated trading process. Basically, what you need to do is draw a button that uses your URL. When you get a signal from your strategy, you would have to click on the buy sell buttons, which launches a browser with your specified URL string.

    The URL needs to be created as a string which would be built with the necessary parameters for buy/sell, price etc., within your strategy at the same instance that your signals occur. But only if you have parameters such as price that need to be changed in the URL string. If you just need market buy/sell buttons you won't need to redraw the buttons. If you do need to redraw the buttons all you need to do is set your global variables for price or type to the appropriate values and then call drawButtons(). Let me know if you need more help with this.

    Here's a basic code example to get you started.

    ChrisTradeButtons.efs

    PHP Code:
    function preMain() {
        
    setStudyTitle("Trade Buttons ");
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);
        
        var 
    dp1 = new FunctionParameter("Size"FunctionParameter.NUMBER);
        
    dp1.setName("Lot Size");
        
    dp1.setLowerLimit(1);
        
    dp1.setDefault(100);    
    }

    var 
    bEdit true;
    var 
    vSize 100;
    var 
    vBaseURL = ("http://dealer.com/services/auto.asmx/" 
                  
    "[email protected]+
                  
    "&PWD=chris&Pair=GBP/");
    var 
    sBuyURL = (vBaseURL "USD&BuySell=B&Amount=" vSize);
    var 
    sSellURL = (vBaseURL "USD&BuySell=S&Amount=" vSize);

    function 
    main(Size) {
        if (
    bEdit == true) {
            if (
    Size != nullvSize Size;
            
    drawButtons();
            
    bEdit false;
        }
        
        
    // add your strategy code here
        
        
    return;
    }

    function 
    drawButtons() {
        
    drawTextAbsolute(549" Buy @URL="+sBuyURLColor.whiteColor.green
            
    Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.FRAME|Text.ONTOP|Text.BOLD|Text.CENTER
            
    "Arial"12"Buy");
        
    drawTextAbsolute(529" Sell @URL="+sSellURLColor.whiteColor.red
            
    Text.RELATIVETOLEFT|Text.RELATIVETOBOTTOM|Text.FRAME|Text.ONTOP|Text.BOLD|Text.CENTER
            
    "Arial"12"Sell");
            
        return;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X