Announcement

Collapse
No announcement yet.

Last Bar/Tick Value/SetComputeOnClose

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

  • Last Bar/Tick Value/SetComputeOnClose

    If SETCOMPUTEONCLOSE is not being used and you getting live tick by tick date, does this previous value below give you the LAST TICK ema value, or the LAST BAR ema value?

    DOWEMAValue = ema(2,ohlc4(sym(DOWiSymbol + "," + iIntervalLO)));
    DOWEMAValuePREV = DOWEMAValue.getValue(-1);

    If tick, how would you get the last ema value of the last bar in this case?

    UPDATE: I did a test and found out the value is the last BAR's value. Out of curiosity, how would you capture the last tick value? Obviously any "-1" stuff wil refer to last bar.
    Last edited by alexmihh; 12-01-2006, 10:53 AM.

  • #2
    Re: Last Bar/Tick Value/SetComputeOnClose

    alexmihh
    To do that you need to create two global variables one to store the current value and one for the prior value. Then in main before you calculate the current value you assign the last calculated value to the variable that will hold the previous value (see enclosed example)
    Alex

    PHP Code:
    var currTick 0;
    var 
    prevTick 0;

    function 
    main(){

        
    prevTick currTick;

        
    currTick close(0);

        
    debugPrintln(currTick+"  "+prevTick);

        return;


    Originally posted by alexmihh
    If SETCOMPUTEONCLOSE is not being used and you getting live tick by tick date, does this previous value below give you the LAST TICK ema value, or the LAST BAR ema value?

    DOWEMAValue = ema(2,ohlc4(sym(DOWiSymbol + "," + iIntervalLO)));
    DOWEMAValuePREV = DOWEMAValue.getValue(-1);

    If tick, how would you get the last ema value of the last bar in this case?

    UPDATE: I did a test and found out the value is the last BAR's value. Out of curiosity, how would you capture the last tick value? Obviously any "-1" stuff wil refer to last bar.

    Comment

    Working...
    X