New version 17 available now


Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

histogram Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
ovjbksfbgos
Posted : Tuesday, December 01, 2015 10:54:04 AM
Gold Customer Gold Customer

Joined: 5/27/2014
Posts: 12

Hello,

If I want to create a formula to have a histogram (similar to MACD) showing the difference between two MA, let's say 20 and 50 possible in two colors for difference >0 and <0, is there an easy way?

 

thanks in advance

Bruce_L
Posted : Tuesday, December 01, 2015 11:03:43 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Well if it is just the difference between two moving averages, that would be a MACD. You could just change the Plot Style of the MACD to Histogram (this would not turn it into a MACD Histogram as the math is different) and check Negative Value Color so it plots using two colors instead of one.

If you really want to do this with a Custom PCF Indicator then the basic technique is the same. Change the Plot Style to Histogram and check Negative Value Color.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ovjbksfbgos
Posted : Tuesday, December 01, 2015 12:25:36 PM
Gold Customer Gold Customer

Joined: 5/27/2014
Posts: 12

thanks for the quick answer.

it's ok for me to use the MACD Histogram, but I don't understand how to configure it.

If I want to see when MA20 and MA50 cross each other, should I configure MACD so that long is 50, short is 20? but what trigger should I use? with any value, the resullt is not matching the plot.

 

thanks in advance

Bruce_L
Posted : Tuesday, December 01, 2015 12:29:25 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

With a MACD indicator (not the MACD Histogram indicator), you would set the Short to 20 and the Long to 50 if the 20 and 50 are moving averages of price. You would set the Average Type of the MACD indicator to match the Average Type of the two moving averages of price.

You would not set a Trigger because it is not going to be one of the settings in the plain MACD indicator.

The other setting you will be changing is the Plot Style of the MACD indicator. You will want to change it from Line to Histogram and then check Negative Value Color.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ovjbksfbgos
Posted : Tuesday, December 01, 2015 12:51:33 PM
Gold Customer Gold Customer

Joined: 5/27/2014
Posts: 12

thanks a lot, exactly what I was trying to do

Chris55
Posted : Tuesday, July 11, 2017 7:04:07 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

How would you write an indicator PCF for displaying the (historgram type) spread between an EMA20 and an EMA100 of the same stock?

Based on this, I would also like to write a Condition PCF for determining when this respective spread decreases "on average" (not imperative to have each consequtive spread bar being lower than the prior one) for the last 5 bars.

Many thanks for your help with this.

Kind regards,

Chris 

 

Bruce_L
Posted : Tuesday, July 11, 2017 9:19:15 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

The difference between two moving averages is a MACD. You can set the Plot Style to Histogram if you want it plotted as a Histogram (this won't turn it into a MACD Histogram because the math is different).

If you only care about the absolute distance between the two (and not which is above the other), than you could use the following Formula in a Custom PCF Indicator instead of using MACD.

ABS(XAVGC20 - XAVGC100)

As far as checking for the spread to be decreasing, you could check for the linear regression slope of the spread to be negative.

FAVG(ABS(XAVGC20 - XAVGC100), 6) < AVG(ABS(XAVGC20 - XAVGC100), 6)

You could check for the net change in the spread to be negative.

ABS(XAVGC20 - XAVGC100) < ABS(XAVGC20.6 - XAVGC100.6)

You could check for the spread decreasing on at least 3 of the 5 bars.

CountTrue(ABS(XAVGC20 - XAVGC100) < ABS(XAVGC20.1 - XAVGC100.1), 5) >= 3

You could check for the current spread to be the lowest.

ABS(XAVGC20 - XAVGC100) < MIN(ABS(XAVGC20.1 - XAVGC100.1), 5)

You could combine as many of these ideas as you want into a single formula.

FAVG(ABS(XAVGC20 - XAVGC100), 6) < AVG(ABS(XAVGC20 - XAVGC100), 6) AND CountTrue(ABS(XAVGC20 - XAVGC100) < ABS(XAVGC20.1 - XAVGC100.1), 5) >= 3 AND ABS(XAVGC20 - XAVGC100) < MIN(ABS(XAVGC20.1 - XAVGC100.1), 5)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Tuesday, July 11, 2017 10:22:32 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks Bruce - that's a real flexible approach. I really appreciate your input. Chris 

Chris55
Posted : Thursday, July 13, 2017 2:14:48 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

I'm now trying to plot a histogram (or spread) of two different MA's (EMA13 on top, and T3-6-1.272 below).

[1] This is the formula I'm using for the PCF Indicator (plotted as a histogram):

((-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) - XAVGC13)

[2] Next, I want to have a scan condition to scan for those spreads which are below 0, using the formula above and adding on " < 0 ".

[3] Thirdly, I want to look at those spreads that are making a 2 bar high (by making a scan condition off the chart for the spread and then adding New High 2 bars.

However, when I scan with with the 2nd or 2nd/3rd criteria, I get many stocks which have a positive spread between EMA13 and T3-6-1.272, presumably because the position of the T3 MA changes from below to above the EMA13.

Do you see any way to adapt this to really only find stocks which show nagtive spreads?

Many thanks,

Chris 

 

Bruce_L
Posted : Thursday, July 13, 2017 2:23:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Does a "positive spread" have the EMA13 above the T3-6-1.272 or the other way around? Because if the EMA is supposed to be above in a positive spread situation, the formula is backwards.

(XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Thursday, July 13, 2017 3:34:36 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Yes, the positive spread would have the EMA13 above the T3-6-1.272.

I did try the formula both ways, once the way it is written above and the other using the

T3 formula {  } - XAVGC13.

Am I overlooking something, as I am getting a mixture of stocks with negative as well as positive [EMA/T3] spreads?

Thanks,

Chris 

Bruce_L
Posted : Thursday, July 13, 2017 3:46:25 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Everything matches up when I do it.

Does the EasyScan Condition use the same time frame as the chart?

Is the EasyScan updated?

Assuming you are checking for the spread on the chart by plotting both moving averages in the price pane, are these plots actually in the same pane and scale as price or just the same pane?

Is the chart scrolled all the way to the right so you are looking at current data?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Thursday, July 13, 2017 4:54:03 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks much, Bruce. If it lines up with your system, I'm sure it'll be okay on mine.

I may not have updated the Easyscan properly. Tomorrow, when I have more time, I'll delete and

redo the Esayscan conditions. I do have both averages on the price pane, and below the price pane I have the histogram spread of the averages on pane #2.

Just to be sure:

Provided the EMA13 is above the T3-6-1.272, I will use the following spread formula for the indicator:

(-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) - XAVGC13
 
And in the Condition PCF I will also use the formula above but stipulate: {    } < 0 in order to only scan for spreads which are negative. 
 
Do you agree?
 
Kind regards,
 
Chris  
 
 
Chris55
Posted : Thursday, July 13, 2017 5:08:00 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

Thanks for pointing that out about the timeframe. I usually never plot a 3 day chart, but it was laid out that way. Must have accidentally hit the "3" - so I was looking at a 3 day chart which of course didn't line up with the spread histogram on the daily chart.

Sorry about that. Thanks for all your help. Really excellent support. 

Chris 

Chris55
Posted : Friday, July 14, 2017 1:57:11 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hello Bruce,

I enjoy using TC2000 daily - it has become my new major platform (previously Ninja Trader).

Aside from my recommendation to possibly include a parallel Linear Regression Channel indicator in future versions, I also wanted to recommend the following three functions for consideration:

- to be able to save entire indicator panes, hence also being able to move them around to different chart templates instead of having to reconstruct them with each move to another chart;

- when editing an Easyscan, it would be nice to be able to activate and deactivate each filter of the scan (rather than just deleting it from the scan and possibly having to access it again multiple times).

- Since Easyscans can take up alot of space on the screen better utilized for charts, it would be nice to have an Easysan 'window' section sotospeak which could layer the Easyscans front to back to conserve space (rather than having to position them side by side.

Thanks for submitting this input for me. Kind regards,

Chris 

Bruce_L
Posted : Friday, July 14, 2017 2:02:49 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Thank you for your suggestions.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, July 21, 2017 10:57:50 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

I have been using this condition formula for the 2 bar slope of the T3-6-1.272 being positive:

(6 * (FAVG(-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179* XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028* XAVG(XAVG(XAVGC6, 6), 6), 2) - AVG(-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179* XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028* XAVG(XAVG(XAVGC6, 6), 6), 2)) / 1) > 0
 
What I would like to achive though is to specify that this T3 slope was positive 5 bars ago.
 
Can this simply be done by changing the "within bars" parameter in the Edit Condition menu, or would the formula itself need to be ammended? If so, is there an easy way to stipulate 5 bars ago, 7 bars ago etc?
 
Thanks very much for your help.
 
Chris 

 

Bruce_L
Posted : Friday, July 21, 2017 11:06:52 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

While I could be misunderstanding your request, I would think you would want x bars ago instead of within last x bars.

x bars ago will check that was true exactly x bars ago.

within last x bars only requires the condition to be true at least within during the most recent x bars.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, July 21, 2017 11:51:19 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Yes, I meant "x" bars ago, but wasn't sure whether the "Edit Condition" parameters would actually work on my custom formula PCF? If I understand correctly, then we would not have to modify the custom formula, but I could just speify 5 bars ago in the respective menu field?

Thanks, Bruce

Chris 

Bruce_L
Posted : Friday, July 21, 2017 11:52:07 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

You would not need to modify the formula if you are using x bars ago in an EasyScan.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, July 21, 2017 12:09:20 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks, bruce, that's good to know.

Just a couple of days ago you created a TrueInRow formula for me which is using the T3-6-1.272 and the EMA13:

TrueInRow(XAVGC13 > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND XAVGC13 > AVGC5 AND AVGC5 > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) AND AVG(H - L, 5) > .2 * (XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))
 
I was wanting to ammend that formula for using the Bollinger Band Top Channel (20, 0.25)
instead of the EMA13, but retaining the same T3 (and it's position below the Bollinger).
 
I would appreciate your help in modifying the formula.
Many thanks.
 
Chris 
Bruce_L
Posted : Friday, July 21, 2017 12:18:42 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Replacing all three instances of XAVGC13 with BBTOP(.25, 20) results in the following.

TrueInRow(BBTOP(.25, 20) > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND BBTOP(.25, 20) > AVGC5 AND AVGC5 > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) AND AVG(H - L, 5) > .2 * (BBTOP(.25, 20) - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, July 21, 2017 12:49:06 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks very much, Bruce - I appreciate all your help. 

Chris55
Posted : Sunday, July 23, 2017 1:42:06 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

The other day you had written a TrueInRow formula for finding stocks between two MA's including some paramaters for the MA Range and the numbers of bars the price had to be between them. I believe that in the formula you supplied, the EMA20 had to be above the EMA100:

TrueInRow(XAVGC20 > XAVGC100, 10) = 10 AND XAVGC20 > AVGC5 AND AVGC5 > XAVGC100 AND AVG(H - L, 5) > .2 * (XAVGC20 - XAVGC100)

Supposing that the relationship of the EMAs towards one another would change, i.e. the EMA100 would now be above of the EMA20, would this ammended formula be correct?

TrueInRow(XAVGC20 < XAVGC100, 10) = 10 AND XAVGC10 < AVGC5 AND AVGC5 < XAVGC100 AND AVG(H - L, 5) > .2 * (XAVGC100 - XAVGC20)

Or is there a way to make the formula independent of the location of the MA's to one another? In this case I would welcome using both variants in a scan, but the 3 variables (in this case 10,5, and 0.2) should remain constant for each variable.

Many thanks,

Chris 

 

 

Bruce_L
Posted : Monday, July 24, 2017 10:48:23 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Your reversal appears to be correct, but please try the following formula would should return true if either is correct.

TrueInRow(SGN(XAVGC20 - XAVGC100) = SGN(XAVGC20.1 - XAVGC100.1), 9) = 9 AND SGN(XAVGC20 - AVGC5) = SGN(XAVGC20 - XAVGC100) AND SGN(AVGC5 - XAVGC100) = SGN(XAVGC20 - XAVGC100) AND AVG(H - L, 5) > .2 * ABS(XAVGC20 - XAVGC100)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Monday, July 24, 2017 3:34:15 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Many thanks, Bruce - that will simplify things. Kind regards, Chris 

Chris55
Posted : Wednesday, August 02, 2017 11:49:38 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

I have drawn a 55 day linear regression line on my chart and want to program an indicator (or a condition) showing when the price reaches -3 StDev below the LR55 line.

I have plotted some other, unrelated conditions in sub-panels which give me a spike when the condition is mt. Something like that would also work for me versus having the -3 StDev line drawn on the chart itself.

It would be good to have the +3 StDev condition as well, relative to the LinReg-55 line.

Thanks much for your help.

Chris 

Bruce_L
Posted : Wednesday, August 02, 2017 11:55:15 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Price being at least 3 SD below the LR55 can be written as follows in TC2000 v17.

C <= 3 * FAVGC55 - 2 * AVGC55 - 3 * STDDEV55

Price being at least 3 SD above the LR55 can be written as follows.

C >= 3 * FAVGC55 - 2 * AVGC55 + 3 * STDDEV55

You can either of the formulas as the Boolean Formula in a Custom PCF % True Indicator to plot spikes on the chart.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Wednesday, August 02, 2017 12:01:07 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks very much - that's exactly what I was trying to get.

By the way, if I change the 3 StDev to 1.5 StDev for example, would I only need to change that number, or is the "- 2" affected in some way?

Kind regards,

Chris 

 

Bruce_L
Posted : Wednesday, August 02, 2017 12:04:07 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

You only need to the change 3 * in front of the STDDEV55. Everything else stays the same.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Saturday, August 05, 2017 12:19:02 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hello Bruce,

Thanks to your help, I have a lot of T3 moving averages plotted with TC2000.

I wanted to get your confirmation or comments if my following T3 related statements are correct or not:

Using the newer formula, are these two sets of four coefficients for the V-Factor correct?

 - Coefficients for -1.272 are: -2.0580756 +11.029179 -19.698131 +11.728028

- Coefficients for -1.618 are: -4.235801 +20.561175096 -33.268947 +17.943573032
 
Secondly, I don't want to calculate the slope of a linear rgeression line of a T3, but need the slope of the T3 moving average itself. If I want to say that the 5-bar slope of a T3-6-1.272 should be positive, is this the correct formula:
 
6 * (FAVG(XAVG(-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.029179* XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG (XAVG(XAVGC6, 6), 6), 6) + 11.728028* XAVG(XAVG(XAVGC6, 6), 6)), 5) - AVG(XAVG(-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.029179 * XAVG
(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 5)) / 4 > 0
 
Many thanks and kind regards,
Chris 
 

 

Chris55
Posted : Saturday, August 05, 2017 1:13:28 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

Regarding my first message above, I just found another formula you had shown me in the past which my be the one to use instead of the FAVG(XAVG... formula. Here it is with an example of T3-6-1.272 for a 5 bar slope. Is this the one you would recomment using just the get the T3 moving average slope?

-(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6 - XAVGC6.5, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6 - XAVGC6.5, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6 - XAVGC6.5, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6 - XAVGC6.5, 6), 6) > 0

Thanks,

Chris 

Bruce_L
Posted : Monday, August 07, 2017 11:28:42 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Your coefficients are fine.

I would write the actual 5 period slope (or rate of change net) as follows.

-(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) - (-(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6.5, 6), 6))

Or check to see if that float is positive using the following.

-(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) > -(1.272 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6), 6), 6) + 3 * ((1.272 ^ 2) + (1.272 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6), 6) - (6 * (1.272 ^ 2) + 3 * (1.272 + (1.272 ^ 3))) * XAVG(XAVG(XAVG(XAVGC6.5, 6), 6), 6) + (1 + 3 * 1.272 + (1.272 ^ 3) + 3 * (1.272 ^ 2)) * XAVG(XAVG(XAVGC6.5, 6), 6)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Thursday, August 10, 2017 4:47:42 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Hi Bruce,

Thanks for your expanation of 8/7 above. Earlier on you gave me the following formula in which the

[1] EMA13 is above the T3-6-1.272 and [2] the price is contained between the two MA's for 10 bars and [3] the average price range is greater than 0.2x the MA spread:

TrueInRow(XAVGC13 > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND XAVGC13 > AVGC5 AND AVGC5 > (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) AND AVG(H - L, 5) > .2 * (XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))

Basically, I would like to formulate the opposite condition, whereby the T3-6-1.272 is above the EMA13, but also for 10 bars and with the same bar range/spread ratio.

How would you code this?

Secondly, would the formaula for finding stocks [highs] reaching 2.5SD above the 55bar LinReg line be specified like this?

H <= 3 * FAVGC55 - 2 * AVGC55 + 2.5 * STDDEV55

 

Many thanks and kind regards,

Chris 

Bruce_L
Posted : Friday, August 11, 2017 9:12:44 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

The formula actually seems to check for EMA13 > T3-6-1.262 for 10 bars in a row, with SMA5 currently in between them and the 5 period average range being greater than .2 * the current spread of the moving averages.

Inverting this would result in the following.

TrueInRow(XAVGC13 < (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND XAVGC13 < AVGC5 AND AVGC5 < (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)) AND AVG(H - L, 5) > .2 * ABS(XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))

If instead you want TS-6-1.272 above EMA13 with price in between for 10 bars in a row with the 5 period average range being greater than .2 * the current spread of the moving averages.

TrueInRow(XAVGC13 < C AND C < (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND AVG(H - L, 5) > .2 * ABS(XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))

If you just want T3-6-1.272 above the EMA13 for 10 bars in a row with the same bar range/spread ratio.

TrueInRow(XAVGC13 < (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)), 10) = 10 AND AVG(H - L, 5) > .2 * ABS(XAVGC13 - (-2.0580756 * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) + 11.028179 * XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - 19.698131 * XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) + 11.728028 * XAVG(XAVG(XAVGC6, 6), 6)))

You have the <= reversed in the last formula.

H >= 3 * FAVGC55 - 2 * AVGC55 + 2.5 * STDDEV55



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, August 11, 2017 9:27:58 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks so much, Bruce

That helped a lot. Just to be sure about the opposite formula for the Price Low reaching 2.5SD ABOVE the 55 bar LinReg Line - would that be:

L <= 3 * FAVGC55 - 2 * AVGC55 - 2.5 * STDDEV55        ???

Kind regards,

Chris 

 

Bruce_L
Posted : Friday, August 11, 2017 9:38:49 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

Your formula is what I would consider the opposite, but that means in is for the low being at least 2.5 standard deviations below the linear regression line (not above). I am guessing this is what you want.

But if you wanted the low to be at least 2.5 SD above, you would use the same syntax as for the high, but with L replacing H.

L >= 3 * FAVGC55 - 2 * AVGC55 + 2.5 * STDDEV55



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Chris55
Posted : Friday, August 11, 2017 9:42:07 AM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139

Thanks, Bruce. Yes, I wanted the second one to be 2.5SD below the LR Line. 

Chris55
Posted : Wednesday, August 16, 2017 2:10:57 PM
Gold Customer Gold Customer

Joined: 6/14/2016
Posts: 139
Hi Bruce,
 
A while back you provided a formula for a decreasing spread between the T3-36-1.272 (on top) and the T3-6-1.272 (below), for the last 10 bars I believe it was:
 
-2.0580756 * (XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36), 36), 36) - XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6)) + 11.028179 * (XAVG(XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36), 36) - XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6)) - 19.698131 * (XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36) - XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6)) + 11.728028 * (XAVG(XAVG(XAVGC36, 36), 36) - XAVG(XAVG(XAVGC6, 6), 6)) < -2.0580756 * (XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36), 36), 36) - XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6), 6), 6)) + 11.028179 * (XAVG(XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36), 36) - XAVG(XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6), 6)) - 19.698131 * (XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36) - XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6)) + 11.728028 * (XAVG(XAVG(XAVGC36.10, 36), 36) - XAVG(XAVG(XAVGC6.10, 6), 6))
 
How would you write the formula for a decreasing spread if the MAs were reversed, ie the T3-6-1.272 on top and the T3-36-1.272 below?
 
Many thanks,
 
Chris 
 
Bruce_L
Posted : Wednesday, August 16, 2017 2:16:02 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,018

I would just reverse all of the 36s and 6s in the formula using a text editor.

-2.0580756 * (XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6), 6) - XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36), 36), 36)) + 11.028179 * (XAVG(XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6), 6) - XAVG(XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36), 36)) - 19.698131 * (XAVG(XAVG(XAVG(XAVGC6, 6), 6), 6) - XAVG(XAVG(XAVG(XAVGC36, 36), 36), 36)) + 11.728028 * (XAVG(XAVG(XAVGC6, 6), 6) - XAVG(XAVG(XAVGC36, 36), 36)) < -2.0580756 * (XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6), 6), 6) - XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36), 36), 36)) + 11.028179 * (XAVG(XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6), 6) - XAVG(XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36), 36)) - 19.698131 * (XAVG(XAVG(XAVG(XAVGC6.10, 6), 6), 6) - XAVG(XAVG(XAVG(XAVGC36.10, 36), 36), 36)) + 11.728028 * (XAVG(XAVG(XAVGC6.10, 6), 6) - XAVG(XAVG(XAVGC36.10, 36), 36))



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.