Custom Symbol with Ensign ESPL

Discussion in 'Trading Software' started by Dart, Aug 10, 2006.

  1. Dart

    Dart

    I want to create a custom symbol with Ensign ESPL, because the available choices for custom symbol types (in the Set-Up menu) is too limited for what I want to do.

    What I want to do is create a custom symbol for the dollar index, as my feed IB provides each individual currency quote, but not the USDX.

    The dollar index uses the following formula:

    USDX = 50.14348112 ×
    (1/EURUSD)^0.576 ×
    USDJPY^0.136 ×
    (1/GBPUSD)^0.119 ×
    USDCAD^0.091 ×
    USDSEK^0.042 ×
    USDCHF^0.036

    This formula uses powers [^]. Is it possible to create such a custom symbol with ESPL? That updates realtime from the currency quotes? If so, how would I do it?
     
  2. Arnie

    Arnie

    I think you might be able to do that with the Custom Symbol feature. You could "build" it by doing one part as custom symbol (1) and then reference custom symbol (1) with another part that becomes custom symbol (2) which you would reference in custom symbol (3) and so on. Custom Symbol is under Set-Up.
     
  3. Dart

    Dart

    Arnie, custom symbols are not able to do powers in Ensign. And apparently Howard said nobody in his 20 years of running Ensign has ever had such a request for a custom symbol with powers before. So it's only possible in ESPL. He has no plans to add powers to Custom Symbols (under Set-Up).

    So... on to the scripting.
     
  4. Dart

    Dart

    My ESPL Dollar Index script so far, using the CME Globex forex futures feeds from Interactive Brokers.

    procedure MyCustomSymbol;

    var
    eur, jpy, gbp, cad, sek, chf: real; {the six symbols variables (1-6): EUR, JPY, GBP, CAD, SEK, CHF}
    thepower:real; {swap variable used for powers}
    indexvalue:real; {stores final value}

    begin

    SetMarket(eFuture);

    eur:=Get(Trim(CustomSymbol(eSymbol,'$DX',1)));
    eur:=1/eur;
    thepower:=CustomSymbol(eMultiplier, '$DX',1);
    eur:=Power(eur,thepower);

    jpy:=Get(Trim(CustomSymbol(eSymbol,'$DX',2)));
    jpy:=jpy/100; {make quote equiv to TWS}
    jpy:=1/jpy; {invert quote}
    thepower:=CustomSymbol(eMultiplier, '$DX',2);
    jpy:=Power(jpy,thepower);

    gbp:=Get(Trim(CustomSymbol(eSymbol,'$DX',3)));
    gbp:=1/gbp;
    thepower:=CustomSymbol(eMultiplier, '$DX',3);
    gbp:=Power(gbp,thepower);

    cad:=Get(Trim(CustomSymbol(eSymbol,'$DX',4)));
    cad:=1/cad;
    thepower:=CustomSymbol(eMultiplier, '$DX',4);
    cad:=Power(cad,thepower);

    sek:=Get(Trim(CustomSymbol(eSymbol,'$DX',5)));
    sek:=1/sek;
    thepower:=CustomSymbol(eMultiplier, '$DX',5);
    sek:=Power(sek,thepower);

    chf:=Get(Trim(CustomSymbol(eSymbol,'$DX',6)));
    chf:=1/chf;
    thepower:=CustomSymbol(eMultiplier, '$DX',6);
    chf:=Power(chf,thepower);

    indexvalue:=eur*jpy*gbp*cad*sek*chf;
    indexvalue:=indexvalue*50.14348112;
    indexvalue:=Format('%.2f',indexvalue);

    Update('$DXC', indexvalue);

    end;


    Now my question is, how do I make this script update my charts real-time? I guess I have to loop it somehow. I'm not sure what is the standard way.
     
  5. Dart

    Dart

    Note that the above script is using a Custom Symbol to retrieve the symbols and multiplication for the powers. This way you can quickly edit the symbols on each rollover. Also you can move the decimal point on the powers if you are using a different data feed with a different price format.

    Attached is a screenshot of the custom symbol setup.