TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule

TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions

Worden Discussion Forum » General Discussions » Stock and Market Talk » Ichimuko test in progress

Hi Bruce,

I don't know whether this is realistic and could be done with an AND function of sorts;

I have one Easyscan and would like to incude three Ichimoku based fileters which include:

Just forgot one thing:

How would you code the following:

The Tenkan crosses the Kijun up above the Kumo cloud?

Thnaks much,

Chris

If you want to require all three to be true, then you can just add each formula individually to the EasyScan (or combine the formulas into a single EasyScan using AND between each formula).

If you only want to require at least one of the formulas to be true, then you can combine the formulas into a single formula by putting OR between each formula.

Tenkan crossing up through Kijun above the Kumo cloud can be written as follows.

XUP(MAXH9 + MINL9, MAXH26 + MINL26) AND MAXH26 + MINL26 > GREATEST((MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 2, MAXH52.26 + MINL52.26)

Thanks very much, Bruce. That was very helpful. Didn't know that the filters could be tied together with AND that easily.

Are you sure that the entire results for each formula which I cmbined into one Scan PCF are being shown as results, no common denominators, right?

Have one more Ichimkou filter I am haing tgrouble programming:

I am sure as long as you are doing it the right way.

If all of the conditions need to be true, use AND, or just add all of the conditions to the EasyScan on their own.

If only one of the conditions needs to be true, use OR instead.

Note that OR happens before AND in the order of operations, so if you want the AND to happen first, you would need to use parentheses to force the order of operations (what is inside the parantheses is calculated before what is outside parentheses).

Chiku (Lagging) Span above Price is the following.

C > C26

Thanks a lot, Bruce. Good new insight. Chris

Good Morning Bruce,

1) How would you write this for a Condition PCF:

- Price crosses up through the Tenkan OR the Kijun?

2) Is this correct for the Price being underneath the cloud and then breaking up through the cloud (Senkou Span A):

C > (MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4 AND C > (MAXH52.26 + MINL52.26) / 2 AND (C1 <= (MAXH9.27 + MINL9.27 + MAXH26.27 + MINL26.27) / 4 OR C1 <= (MAXH52.27 + MINL52.27) / 2)

3) Is this one correct as well: Senkou Span A is greater than Senkou Span B:?

(MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4 > (MAXH52.26 + MINL52.26) / 2

4) If I were to use: "Price close is above the cloud"

C > (MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4 AND C > (MAXH52.26 + MINL52.26) / 2

Could I alter this by using the condition "Within the last 3 bars", or would that have to be coded into the formula?

Many thanks for your info.

I am pretty sure what you have works just fine.

Price crosses up through Tenkan or Kijun.

XUP(C, (MAXH9 + MINL9) / 2) OR XUP(C, (MAXH26 + MINL26) / 2)

Price crossing up through bottom of cloud.

XUP(C, LEAST((MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4, (MAXH52.26 + MINL52.26) / 2))

Price crossing up through Senkou Span A.

XUP(C, (MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4)

Senkou Span A greater than Sekou Span B.

Price above the cloud.

C > GREATEST((MAXH9.26 + MINL9.26 + MAXH26.26 + MINL26.26) / 4, (MAXH52.26 + MINL52.26) / 2)

You should be able to use within the last 3 bars. You could also put whatever you want inside the following construct.

CountTrue(your condition formula here, 3) > 0

CountTrue(

, 3) > 0

Thanks so much, Bruce, works really well. Chris

Hi Brice,

Am triying to create a 7 period HMA and a 3-bar slope. Would like to write a PCF for a the positive slope showing on the top half of a histrogram, and the negarive slopes on the botton.

What Indicator PCFs would you use here? Possible to change the HMA7 into a HMA5 after the fact?

Thanks much.

By slope do you just mean the period net change?

HAVGC7 - HAVGC7.3

Or maybe the 3 period linear regression slope?

6 * (FAVG(HAVGC7, 3) - AVG(HAVGC7, 3)) / (3 - 1)

Or even the 4 period linear regerssion slope (as it covers the same span as the 3 period net change)?

6 * (FAVG(HAVGC7, 4) - AVG(HAVGC7, 4)) / (4 - 1)

Sorry Bruce,

I meant the 3-period LinReg slope...

I plugged the 3period LinReg formula into an Indicator PCF and get a parenthesis error "(" at position 14.

Thanks Bruce for all three formulas. That makes it easy to adapt later. Currently, I'm using this one:

6 * (FAVG(HAVG7, 3) - AVG(HAVG7, 3)) / 2

The resulting histogram doesn-t show +-1, but rather rises and falls around the 0 line, which is also quite usage.

Thanks again. KInd regards,

The formula is missing the C term in the hull moving averages.

If you want it to show 1 or -1 instead, put the entire thing in a SGN() function.

SGN(6 * (FAVG(HAVGC7, 3) - AVG(HAVGC7, 3)) / (3 - 1))

Thanks very much Bruce.

Recently you gave me some PCF code for solving the following condition:

The T3-4-1.618 is crossing up through EITHER the T3-8-1.618 OR crossing up through the T3-6-1.272 within the last 2 bars. Here is the code:

CountTrue(XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8), 8) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8) - 33.268947 * XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8) + 17.943573032* XAVG(XAVG(XAVGC8, 8), 8)), 2) > 0 OR CountTrue(XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6, 6), 6)), 2) > 0

I wonder if you could help me with the following two issues:

1) I need to change the above formula to "crossing within the last 1 bar" (versus 2 bars).

2) I need the same (crossing within the last 1 bar) code, but rather than crossing up, it should show when the T3-4-1.618 is crossing DOWN on either the T3-8-1.618 ot the T3-6-1.272. (I am presuming that the formula above "crossing within the last 2 bars" defines crossing "up". When I plot it, it only shows the upside crosses, not the downside crosses.

Many thanks, Bruce.

By the way: you gave me a generic master formula as follows:

CountTrue(XUP(T3-4-1.618, T3-8-1.618), 3) > 0 OR CountTrue(XUP(T3-4-1.618, T3-6-1.272), 3) > 0

1) Would I replace the two "3's" with "0" if I wanted to see the cross NOW? (Instaed od 1 bar ago);

2) Would I change the two "XUP" to "XDOWN" to get the T3-4-1.618 crossing down through either the T3-8-1.618 or the T3-6-1.272?

If so then I could fill it in myself. Thanks.

If you want it for the current bar, you could just not use the CountTrue at all (if you do use CountTrue(), then change the 3 to 1 instead for it to be the current bar).

XUP(T3-4-1.618, T3-8-1.618) OR XUP(T3-4-1.618, T3-6-1.272)

XUP(

,

) OR XUP(

)

Yes, you can just change the XUP() function to a XDOWN() function to check for crosses in the other direction.

XUP()

XDOWN()

Many thanks Bruce - that helps alot. Chris

Just to be sure. Is this the PCF for the current bar only:

WAS:

IS (for current bar):

(XUP(T3-4-1.618, T3-8-1.618), 1) > 0 OR CountTrue(XUP(T3-4-1.618, T3-6-1.272), 1) > 0

Thanks.

Yes, that would work, but I would just use the shorter version from my Thursday, April 19, 2018 9:38:19 AM ET post if you are interested in just the current bar.

Sorry to be a bother, when I use this folumula for Crossing UP now:

(XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8), 8) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8) - 33.268947 * XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8) + 17.943573032* XAVG(XAVG(XAVGC8, 8), 8)) OR (XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6, 6), 6))

I get a formula error, unmatched parenthesis at 949 or similar??

Each section should start with XUP( versus having each section start with (XUP( (note that this parenthesis is not in the template given above). I guess you could also put another ) at the end of each section, but those parenthese would not be necessary.

XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8), 8) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8), 8) - 33.268947 * XAVG(XAVG(XAVG(XAVGC8, 8), 8), 8) + 17.943573032* XAVG(XAVG(XAVGC8, 8), 8)) OR XUP(-4.235801 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4), 4) + 20.561175096* XAVG(XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4), 4) - 33.268947 * XAVG(XAVG(XAVG(XAVGC4, 4), 4), 4) + 17.943573032* XAVG(XAVG(XAVGC4, 4), 4), -(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6, 6), 6))

Thanks, I couldn't fiure that one out.

Good Monring Bruce,

I wonder if you could help me with a PCF for the following to be true (or to show as +1 in a histogram):

- There should be more than one narrow range bar within the last 10 bars;

- A narrow bar would be considered from NR4 to NR7 or narrower.

I would like to use this condition for scans, but also to show when it is true on a histogram.

Many thanks.

I found this Volume Flow Indicator formula (Scan PCF) in the forum and wondered whether there is any way ti make it more sensitive, i.e. faster:

XAVG(IIF(AVGV130.1 > 0, SUM(IIF(ABS(H + L + C - H1 - L1 - C1) / 3 > .2 * SQR(ABS((SUM((LOG((H + L + C) / 3) - LOG((H1 + L1 + C1) / 3)) ^ 2, 30) - SUM(LOG((H + L + C) / 3) - LOG((H1 + L1 + C1) / 3), 30) ^ 2 / 30) / 30)) * C, SGN(H + L + C - H1 - L1 - C1) * LEAST(V, AVGV130.1 * 2.5), 0) , 130) / AVGV130.1, 0), 3)

It seems to be using 3 bars? If so, can you expand it to the last 10 bars?

Thanks,

You're probably away from the office this week. I wanted to comment on the followng:

- If it is cumbersome or not possible to make the "Volume Flow Indicator", above, more sensitive and faster, then I have a good alternative for it (or in addition to it):

- The condition is: "Volume exceeds 1.618 times the average volume of the last 6 volume bars".

- Do you think it can be coded in such a way as to place a dot about the respective volume bar for which the condition is true? Or in a separate pane?

Thank you much. Kind regards,

So narrower than the previous 4 or more days?

H - L < MIN(H1 - L1, 4)

But this can be true just once in the last 10 bars?

CountTrue(H - L < MIN(H1 - L1, 4), 10) > 0

You can just use it in a Custom PCF % True Indicator set to the Histogram Plot Style.

The Volume Flow Indicator formula seems to use periods of 30 and 130. Use something smaller would make it more sensitive.

You can change the 3 at the end to a 10 if you want, but that will make it less sensitive, not more sensitive.

V > 1.618 * AVGV6.1

If you want it as a dot, you do something like the following.

IIF(V > 1.618 * AVGV6.1, V, 1 / 0)

Thanks very much Bruce,

Pertaining to the Narrow Range bars:

I would like to see more than one NR4 or narrower bar (Narrowest Range in the last 4 bars...) within the last 10 bars. So 2 of them would be the minimum. There are be any number of 2 or more of these narrow bars within the last 10 bars.

Any way to code this condition to see if it occurs more than once within the last 10 bars?

Thanks, Chris

Re the dot on the:

The division by zero error is intentional. It is what makes it so the dot doesn't plot when the requirements are not met.

All you need to do to make sure it is true at least twice is set CountTrue to >= 2 instead of > 0.

CountTrue(H - L < MIN(H1 - L1, 4), 10) >= 2

Many thanks, have a good week. Chris

Hello Bruce,

How would you code a condition PCF to show the SPREAD Between the EMA13 and the BB%B (0.20, 20) is decreasing?

BB%B should have a SD of 0.2 and an exponential period of 20.

I am going to assume the EMA13 is of the BB%B as it would be the only way the question would seem to make sense.

ABS((C - AVGC20) / 2 / .2 / STDDEV20 + .5 - XAVG((C - AVGC20) / 2 / .2 / STDDEV20 + .5, 13)) < ABS((C1 - AVGC20.1) / 2 / .2 / STDDEV20.1 + .5 - XAVG((C1 - AVGC20.1) / 2 / .2 / STDDEV20.1 + .5, 13))

No the EMA13 has a source in Price History, and the BB%B also is sourced by price history.