Announcement

Collapse
No announcement yet.

I'm not sure this is possible??????

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

  • I'm not sure this is possible??????

    Hi

    I'd like to ....

    1. calculate 4 ema's (tf = timeframe)

    o = ema(period1,open(inv(tf));
    h = ema(period1,high(inv(tf));
    l = ema(period1,low(inv(tf));
    c = ema(period1,close(inv(tf));

    2. then calculate smoothed heiken ashi values based on values returned from step 1.

    ha_close = (o+h+l+c)/4;
    ha_open = (ha_open(previous bar) + ha_close(previous bar))/2
    ha_high = Math.max(h,ha_open);
    ha_low = Math.min(l,ha_open);

    3. Smooth again

    calculate 4 new smoothed values using the results calculated in step 2. using the wma function.

    ha2_close = wma(period2,ha_close values from step 2.)
    ha2_open = wma(period2,ha_close values from step 2.)
    ha2_high = wma(period2,ha_close values from step 2.)
    ha2_low = wma(period2,ha_close values from step 2.)

    then if close > open return trend=UP
    if close < open return trend=DOWN

    And I want to do this on 8 timeframes in the same study ... so i end up with 8 trend variables set to UP/DOWN for 8 different timeframes

    Is this possible - I cannot get my head around how to do it!!!!

    Thanks again your help is always much appreciated!

    Paul

  • #2
    Paul,
    What you are asking is possible if you convert your variables to series.

    Right now your ha_x variables are single values instead of a series. You can convert them to a series using an efsInternal function and putting your ha_x calculations inside an efsInternal function.

    Then you could use that series as the source for the wma.

    The knowledgebase has articles about efsInternal that explains how it works.

    Steve

    Comment

    Working...
    X