Announcement

Collapse
No announcement yet.

EFS questions

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

  • EFS questions

    Hi,

    I am writing my first efs strategy and have some questions. First, my strategy is built using moving average crossovers for buy and sell signals. When I first load the strategy up and it goes through all the back data (from left to right) will that cause positions to be executed or is it just loading the data into the array?

    I notice that I get mulitple alerts on one bar of data. I mean when I am running my efs on a live system my MA's are generate multiple signals. Is there a way to get only one signal per bar? So I can generate only one state?

    Has anyone done this before? When I run my script through the back tester the results are very good, so I must be missing something?

    I use MBtrading, so when I execute my doLongs and doShorts do I need to do something to execute the trades through my broker?

    Thanks,

    Jon

  • #2
    Some help..

    Jon,

    Running on back data is part of the default EFS ability - for backtesting. For realtime execution, you want to use a conditional if statement that allows your code to only run on the most recent bars...

    PHP Code:
    if (getCurrentBarIndex() == 0) {
      ..  
    run your entry trigger and other code

    Controlling the number of signals you get per bar can be handled with a single function (in most cases)..

    PHP Code:
    function preMain()
      ..  
    other stuff
      setComputerOnClose
    (true);
      .. 
    possibly more other stuff

    This will cause your EFS to run only at the end of when a bar finishes forming. There is another way to do this (that I use quite a bit), which tracks the date/time of a bar and waits for a new bar to form. Here are the basics...

    PHP Code:
    var vHour;
    var 
    vMin;
    var 
    vSec;
    var 
    vDay;
    var 
    vMonth;
    var 
    vYear;
    var 
    vTime = new Date();


    function 
    main() {

    // BLM Added....
    //---------------------------------------------------
    //  Get Time Variables
      
    vTime getValue("Time"0);
      
    vHour vTime.getHours();
      
    vMin vTime.getMinutes();
      
    vSec vTime.getSeconds();
      
    vDay vTime.getDate();
      
    vMonth vTime.getMonth() +1;
      
    vYear vTime.getYear();
    //---------------------------------------------------


    //  you would place your STOP and PT conditions here.

    if (nLastRawTime != getValue("rawtime"0)) {
         
    BLBarOffset += 1;
         
    nLastRawTime getValue("rawtime"0);

    //  in here is where you check for the LAST bars signals - like this.
    // remember, using this option, you are waiting for a new bar to form, thus you have to check the previous bars conditions for new entry triggers.
     
    if (close(-1) > open(-1)) {
      ...
    BUY
     
    }
    }

    // end of main() 
    Regarding MBTrading - I don't know if their broker module is a "plug-in" or not to esignal. You can check the www.esignal.com web site for more information. If you want it to be able to place orders automatically, you have to find out if this is available (or available from another "adapter" software application). Otherwise, you'll have to enter them manually.

    Let me know if you need more help.

    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment

    Working...
    X