Announcement

Collapse
No announcement yet.

Paper Trading Forex from EFS

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

  • Paper Trading Forex from EFS

    I can Paper Trade Forex from the PT dialog boxes, but not getting and response to the PT function calls within EFS. No EFS errors, but no trades show up on the Broker window.

    I'm instantiating the PT onbect per the doc'n:
    var oPTB = new PaperTradeBroker();
    sPaperTradeSymbolEFS = getsymbol();
    vPaperTradePositionEFS = 100000;
    oPTB.Buy(sPaperTradeSymbolEFS, vPaperTradePositionEFS, PaperTradeBroker.MARKET);

    Any thoughts? Thanks in advance...
    Knick20

  • #2
    Hello Knick20,

    I notice your getSymbol() call has a lower case s. Try a capital S first and see if that fixes things.

    I would think that the way it currently is, you should be getting a "must provide a symbol" error. Do you have any conditional statements surrounding your oPTB.Buy() call? If so, put a debugPrintln("hello"); statement just before your .Buy() call and see if "hello" prints to the formula output window (Tools-->EFS-->Formula Output Window). If "hello" is not appearing then double-check your conditional statement.

    Here's a piece of code you can test with just to make sure the paper broker is working on your end. If this works for you, then your problem most likely has to do with the getsymbol() call or your conditional statements.

    PHP Code:
    function preMain() {
        
    setStudyTitle("test");
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);

    }

    var 
    oPTB = new PaperTradeBroker();
    var 
    sPaperTradeSymbolEFS getSymbol();
    var 
    vPaperTradePositionEFS 100000;
    var 
    bFlag false;


    function 
    main() {

        if (
    getCurrentBarIndex() != 0) return;
        
        if (
    bFlag == false) {
            
    oPTB.Buy(sPaperTradeSymbolEFSvPaperTradePositionEFSPaperTradeBroker.MARKET); 
            
    bFlag true;
        }
        
        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


    • #3
      Paper Trading from EFS

      Many thanks, Jason! Sorry to bother on such an obvious syntax error.

      Didn't mention in the original post, but I also had left setComputeOnCLose() turned on. Put in a work around to enable trading on bar intervals only (first-tick-of-new-bar), and fixed the getSymbol() - and was able to get EFS papertrading to work.

      Curiously, I also had to avoid using the getHolding() and getPending() functions. Probably something I'm not doing right, I need to check deeper before sounding alarms. Thanks again.
      Knick20

      Comment

      Working...
      X