Announcement

Collapse
No announcement yet.

Working with Futures Volume data

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

  • Working with Futures Volume data

    Dear All,


    I am having esignal On-Demand and work heavily with Volume data. There are some things I want to achieve but my knowledge of programming is near to zero.
    I am aware of the daily Volume display of esignal on futures and I am sure anything can be programed by the users.

    I would greatly appreciate some help with my following projects:

    1. With this attached script I wish to achive that on the daily futures chart the Combined Volue of the instrument is displayed. It works so far but I want the color to be based on the close price of the continous contract compared to the previous close. That does not seem to work.

    2. I would also like to have this script combined with the Cumulative Volume sript so, that the last day Volume will be calculated as the cumulative Volume of the lover timeframe, as intraday Volume is avaliable. I am aware of this as being an estimate. I am having difficulties with this task.

    3. I would like to be able to see Volume on the daily spot FX charts, so that the cumulated intraday Volume is displayed for each bar. I know this is not real volume. It is not real intraday either.

    I am having a hard time with scripting in general but I believe the above can be done easily to someon with experience. I wellcome any help and am greatful for it.

    Kind Regards

    Zol
    Attached Files

  • #2
    Zol,

    Below I address your first request as to why the script doesn't work (see notes). The enclosed scripts are two ways to make your original script work.
    I don't understand what you are asking in question 2 since the daily volume is by definition the cumulative intraday volume (at least as I understand it).
    I don't trade FX so I can't test against FX charts or data. So, at least for question 1, here is my input.
    PHP Code:
    //method1
    var fpArray = new Array ();

    function 
    preMain() {
        
        
    setStudyTitle("Daily Futures Combined Volume");
        
    setCursorLabelName("Volume");
        
    setShowTitleParameters(false);
        
    setPlotType(PLOTTYPE_HISTOGRAM);
        
    setIntervalsBackfill(true);
       
         var 
    0;
        
    fpArray[x] = new FunctionParameter("VSymbol"FunctionParameter.STRING);
        
    with(fpArray[x++]){//from what I can tell you only need one symbol definition
            
    setDefault(getSymbol ());
        }
        var 
    fp1 = new FunctionParameter("UpColor"FunctionParameter.COLOR);
            
    fp1.setName("Up Color");
            
    fp1.setDefault(Color.green);
        var 
    fp2 = new FunctionParameter("DnColor"FunctionParameter.COLOR);
            
    fp2.setName("Down Color");
            
    fp2.setDefault(Color.red);
        var 
    fp3 = new FunctionParameter("Thick"FunctionParameter.NUMBER);
            
    fp3.setName("Thickness");
            
    fp3.setDefault(3);
        var 
    fp4 = new FunctionParameter("sOption"FunctionParameter.STRING);
            
    fp4.setName("Display Option");
            
    fp4.addOption("Based on Previous Vol Bar");
            
    fp4.addOption("Based on Current Price Bar");
            
    fp4.setDefault("Based on Current Price Bar");//note: the script only uses Price data and no volume
    }

    var 
    bInit false;
    var 
    nDisplay 2;  // 1 = Prev Vol Bar,  2 = Cur Price Bar

    function main(VSymbolUpColorDnColorThicksOption) {
        if (
    isDaily() == false) {
            if (
    bInit == false) {
                
    addEntitlement("DailyFutVolume123""This study requires a dialy interval");
                
    bInit true;
            }
            return;
        }
        
        if (
    bInit == false) {
            
    setDefaultBarThickness(Thick);
            if (
    sOption == "Based on Previous Vol Bar"nDisplay 1;
            else 
    nDisplay 2;
            
    bInit true
        
    }
        
        var 
    nVol_0 close (-1sym(VSymbol));//index values are negative
        
    var nVol_1 close (0sym(VSymbol));//use the sym() function see "close" in KB
        
        
    if (nDisplay == 1) {
            if (
    nVol_0 >= nVol_1setBarFgColor(UpColor);
            else 
    setBarFgColor(DnColor);
        } else {
            if (
    nVol_1 >= nVol_0setBarFgColor(UpColor);
            else 
    setBarFgColor(DnColor);
        }
        
        return 
    nVol_0;//note: this returns the previous volume not the current vol

    PHP Code:
    //method2
    var fpArray = new Array ();

    function 
    preMain() {
        
        
    setStudyTitle("Daily Futures Combined Volume");
        
    setCursorLabelName("Volume");
        
    setShowTitleParameters(false);
        
    setPlotType(PLOTTYPE_HISTOGRAM);
        
    setIntervalsBackfill(true);
       
        var 
    0;
        
    fpArray[x] = new FunctionParameter("VSymbol"FunctionParameter.STRING);
        
    with(fpArray[x++]){//from what I can tell you only need one symbol definition
            
    setDefault(getSymbol ());
        }
        var 
    fp1 = new FunctionParameter("UpColor"FunctionParameter.COLOR);
            
    fp1.setName("Up Color");
            
    fp1.setDefault(Color.green);
        var 
    fp2 = new FunctionParameter("DnColor"FunctionParameter.COLOR);
            
    fp2.setName("Down Color");
            
    fp2.setDefault(Color.red);
        var 
    fp3 = new FunctionParameter("Thick"FunctionParameter.NUMBER);
            
    fp3.setName("Thickness");
            
    fp3.setDefault(3);
        var 
    fp4 = new FunctionParameter("sOption"FunctionParameter.STRING);
            
    fp4.setName("Display Option");
            
    fp4.addOption("Based on Previous Vol Bar");
            
    fp4.addOption("Based on Current Price Bar");
            
    fp4.setDefault("Based on Current Price Bar");
     }
    var 
    nDisplay 2;// 1 = Prev Vol Bar,  2 = Cur Price Bar
    var bInit false;
    var 
    Close;//added to create a series of the close for the selected "VSymbol"
    function main(VSymbolUpColorDnColorThicksOption) {
        if (
    isDaily() == false) {
            if (
    bInit == false) {
                
    addEntitlement("DailyFutVolume123""This study requires a dialy interval");
                
    bInit true;
            }
            return;
        }
        if (
    bInit == false) {
            
    setDefaultBarThickness(Thick);
            if (
    sOption == "Based on Previous Vol Bar"nDisplay 1;
            else 
    nDisplay 2;
            
    Close close(sym(VSymbol));//use the sym() function.  See "close" in KB
            
    bInit true
        
    }
        
        if (
    nDisplay == 1) {
            if (
    Close.getValue(-1) >= Close.getValue(0)) setBarFgColor(UpColor);
            else 
    setBarFgColor(DnColor);
        } else {
            if (
    Close.getValue(0) >= Close.getValue(-1)) setBarFgColor(UpColor);
            else 
    setBarFgColor(DnColor);
        }
        
        return 
    Close.getValue(-1);//note: this returns the previous volume not the current vol

    Wayne
    Last edited by waynecd; 05-13-2013, 09:15 PM.

    Comment


    • #3
      Hello Wayne

      Thank you so much that you have taken the time for this. I will now have a look and try to learn so next time i can make use of your input.
      Regarding the combined Volume you are right - as far as stocks go.
      For FX, however, there is intraday volue provided (as tick Volume) but it is not cumulated for the daily bars.
      For futures, the daily Volume data is not provided as the cumulated intraday Volume, rather as the reported daily Volume from the exchange. That comes a day later so there is a one day delay in the daily Volume data.

      There is a script avaliable, which provides the cumulated intraday data on the intraday charts. Sadly, I am unable to make this information visible on the daily charts. That was somehow meant to be question 2 and 3.

      I actually am able to use the 4H charts or even a chart with 1440 min timeframe. These are good enough. I also use the ETF stocks for comodities and major currencies to reveal unusual activities.

      Thank you once again your help. it pushed me forward.

      Kind Regards

      Zol
      Attached Files

      Comment


      • #4
        Hi Zol,

        Glad to hear it.

        Wayne

        Comment


        • #5
          also note that daily volume for US futures is one day behind.
          also note that with FX a new day starts at 17:00 GMT-5
          volume for intraday should be current
          Paul Williams
          Strategy & Applications
          www.futurenets.co.uk

          Comment


          • #6
            Thanks,
            also note that daily volume for US futures is one day behind.
            also note that with FX a new day starts at 17:00 GMT-5
            volume for intraday should be current
            Wayne

            Comment

            Working...
            X