This is the orig main script for the Hull Suite Ive been trying every combination(2 examples below) to make into a MTF nothing works.

def hma = wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)));

Can someone help me out??

---------------------------------------

*Example:*

def hma = wma(2 * (wma(src, length / 2) **(period = time)**)- (wma(src, length), round(sqrt(length))**(period = time)**));

Eaxmple:

def hma = wma**(period = time)**(2 * wma**(period = time)**(src**(period = time)**, length / 2) - wma**(period = time)**(src**(period = time)**, length), round**(period = time)**(sqrt**(period = time)**(length)));

hi

@SleepyZ looks like we tackled this one about the same time. heh

because the plot uses 2nd agg data , there will be horizontal sections of the line, which will have the down color.

----------------------------------

i have seen problems with several 2nd agg functions within a formula, so i separated them out. maybe it's only an issue when they are of different times.

-----------------------------------

there may be a couple of possibilities for why you don't see a plot.

..thinkscript doesn't like formulas that try to calculate 2+ values from (different) 2nd aggregation(s).

it is best to separate the formulas, to calculate the value for each 2nd agg item.

then combine those variables into a final formula. this is what i did.

..there may be an error in your formulas. but we won't know, because you didn't post your complete code.

i don't know what you have set up for time =

this plots a stepped line. there are horizontal sections.

because of this i added a variable called dir, that is used to drive the plot color.

Ruby:

```
def na = double.nan;
def bn = barnumber();
input agg1 = AggregationPeriod.DAY;
def cls_agg1 = close(period = agg1);
input wma_len1 = 20;
# set vars for 1 and 2
def wma1 = wma(cls_agg1, floor(wma_len1 / 2));
def wma2 = wma(cls_agg1, wma_len1);
# do the final wma of the prev 2
# def hma = wma(2 * wma1(src, length / 2) - wma2(src, length), round(sqrt(length)));
def lenx = floor( sqrt( wma_len1));
def wmamtf = wma( ((2 * wma1) - wma2) , lenx);
# direction, use for plot color
def dir = if bn == 1 then 0
else if wmamtf > wmamtf[1] then 1
else if wmamtf < wmamtf[1] then -1
else dir[1];
plot z9 = wmamtf;
z9.AssignValueColor(if dir > 0 then color.green else color.red);
#-----------------------------------
input test2_bubbles = no;
addchartbubble(test2_bubbles, low,
wma1 + " 1\n" +
wma2 + " 2\n" +
wmamtf + " 3"
, color.yellow, no);
input test1 = no;
plot z1 = if test1 then wma1 else na;
plot z2 = if test1 then wma2 else na;
#
#
```