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


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Help setting moving average condition Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Corto
Posted : Friday, January 19, 2018 12:36:10 AM
Registered User
Joined: 6/5/2015
Posts: 107

Please help me set the following condition within a scan:

Exp Moving Average 50 of price history above Exp Mov Avg 100 of price history every day during the last X number of days.

I thought this is straight foward by using True within the last X bars in the Edit Condition window, but I get results that do not verify the condition. 

Thank you,

Corto

StockGuy
Posted : Friday, January 19, 2018 8:46:44 AM

Administration

Joined: 9/30/2004
Posts: 9,187

Try using the new PCF syntax in version 17:

TrueInRow(XAVGC50 > XAVGC100,50) = 50

Just set 50 and = 50 to X number of days.

Corto
Posted : Friday, January 19, 2018 10:47:56 AM
Registered User
Joined: 6/5/2015
Posts: 107

I tried setting a new Condition (PCF) Formula and entered your formula but i keeps asking me to enter a formula. I'm doing something wrong. Please help.

Bruce_L
Posted : Friday, January 19, 2018 10:50:03 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Please try copying and pasting the formula into a text editor (such a Notepad and not a word processor like Word). Then copy and paste from the text editor into TC2000 instead of copying and pasting directly from the forums.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Corto
Posted : Friday, January 19, 2018 10:56:55 AM
Registered User
Joined: 6/5/2015
Posts: 107

This was the trick. Thank you!

Corto
Posted : Friday, January 19, 2018 12:13:41 PM
Registered User
Joined: 6/5/2015
Posts: 107

I seached and found where this TrueInRow syntax is explained and I realized what I wanted was my condition to be true for at least X number o days. In this case I can't figure out the formula. Please help again.

 

Bruce_L
Posted : Friday, January 19, 2018 12:18:10 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

See the two 50s near the end of the formula in bold? Change those to different numbers to change X to something besides 50.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Corto
Posted : Friday, January 19, 2018 12:29:54 PM
Registered User
Joined: 6/5/2015
Posts: 107
So you mean the following will bring results where the condition was true for the past 75 days or more than 75 days in the past?
 
TrueInRow(XAVGC50 > XAVGC100,75) = 75
 
I tend to think instead of the = sign, I would need  > , something like:
 
TrueInRow(XAVGC50 > XAVGC100,75) > 75
Bruce_L
Posted : Friday, January 19, 2018 12:36:13 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You want the first first formula.

TrueInRow(XAVGC50 > XAVGC100,75) = 75

The second formula would never return true because TrueInRow(XAVGC50 > XAVGC100, 75) returns an interegr between 0 and 75. So it can't be greater than 75.

TrueInRow(XAVGC50 > XAVGC100, 75) checks the most recent 75 bars and returns how many bars in a row this was true starting with the current bar. So if the current bar isn't true it will return 0. If the most recent 10 bars (including the current bar) are true but the 11th bar is not, then it would return 10.

So if you wanted to check for exactly 75 bars in a row, you would use the following.

TrueInRow(XAVGC50 > XAVGC100, 76) = 75

Because this would return an integer between 0 and 76 and if more than 75 bars in a row were true, then the formula would be false and if less that 75 bars in a row were true the formulas would also be false.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Corto
Posted : Friday, January 19, 2018 12:41:51 PM
Registered User
Joined: 6/5/2015
Posts: 107

Still confused.

I need the condition satisfied for 75 or more days in a row in the past. 

Bruce_L
Posted : Friday, January 19, 2018 12:52:03 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You want the first first formula from your Friday, January 19, 2018 12:29:54 PM ET post.

TrueInRow(XAVGC50 > XAVGC100,75) = 75



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Corto
Posted : Friday, January 19, 2018 12:56:39 PM
Registered User
Joined: 6/5/2015
Posts: 107

Will this also bring the stock that satisfied the condition for the past 100 consecutice days?

Bruce_L
Posted : Friday, January 19, 2018 1:02:19 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Yes, it will. The formula has no idea what happened on bars 26 through 100. It is only checking for what happened during bars 1 through 75 (with 1 being current bar).

So as long as it was true 75 bars in a row, it doesn't matter if it was true exactly 75 bars in a row or 200 bars in a row, it will still return true.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Corto
Posted : Friday, January 19, 2018 1:11:39 PM
Registered User
Joined: 6/5/2015
Posts: 107

Finally got it. Thanks a lot and sorry for all the hassle.

Bruce_L
Posted : Friday, January 19, 2018 1:12:33 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-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.