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 |

Mean Reversion Swing Setup Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Partha223
Posted : Tuesday, March 13, 2018 7:07:55 PM
Registered User
Joined: 2/13/2018
Posts: 33

Hi Bruce,

 

I came across the mean revsersion strategy Swing setup & pasted the code here for the tradestation. Is there a way this can be replicated in TC2000.

Appreciate your help in replication. Please find the code below

 

Strategy: MeanReversion
 
// Mean-Reversion Swing Trading
 
inputs:
ChanLength( 20 ),
StopDollars( 1 ),
MALength( 50 ) ;
variables:
UpperBand( 0 ),
LowerBand( 0 ),
MidBand( 0 ),
LongOK( false ),
ShortOK( false ),
LowRef( 0 ),
HighRef( 0 ),
TriggerLine( 0 ),
MAValue( 0 ) ;
UpperBand = Highest( High, ChanLength ) ;
LowerBand = Lowest( Low, ChanLength ) ;
MAValue = Average( Close, MALength ) ;
if Low = LowerBand then
begin
LowRef = Low ;
LongOK = false ;
ShortOK = true ;
end ;
if High = UpperBand then
begin
HighRef = High ;
LongOK = true ;
ShortOK = false ;
end ;
// 50% Pull Back Level
TriggerLine = .5 * ( HighRef + LowRef ) ;
if LongOK[1] and LongOK
and Close crosses over TriggerLine
and Close > MAValue
and MarketPosition( 1 ) < 1 then
begin
Buy next bar at Market ;
LongOK = false ;
end
else if ShortOK[1] and ShortOK
and Close crosses under TriggerLine
and Close < MAValue
and MarketPosition( 1 ) > -1 then
begin
SellShort next bar at Market ;
ShortOK = false ;
end ;
Sell next bar at Upperband Limit ;
Sell next bar at Lowerband Stop ;
Buy to Cover next bar at Lowerband Limit ;
Buy to Cover next bar at UpperBand Stop ;
SetStopShare ;
SetStopLoss( StopDollars ) ;

 

 

Indicator: MeanReversion
 
// Mean-Reversion Swing Trading
 

inputs:
ChanLength( 20 ),
MALength( 50 ) ;
variables:
UpperBand( 0 ),
LowerBand( 0 ),
MidBand( 0 ),
LongOK( false ),
ShortOK( false ),
LowRef( 0 ),
HighRef( 0 ),
TriggerLine( 0 ),
MAValue( 0 ) ;
UpperBand = Highest( High, ChanLength ) ;
LowerBand = Lowest( Low, ChanLength ) ;
MAValue = Average( Close, MALength ) ;
if Low = LowerBand then
begin
LowRef = Low ;
LongOK = false ;
ShortOK = true ;
end ;
if High = UpperBand then
begin
HighRef = High ;
LongOK = true ;
ShortOK = false ;
end ;
TriggerLine = .5 * ( HighRef + LowRef ) ;
Plot1( UpperBand, "UpperBand" ) ;
Plot2( LowerBand, "LowerBand" ) ;
Plot3( TriggerLine, "Trigger" ) ;
Plot4( MAValue, "Mov Avg" ) ;
if LongOK then
begin
SetPlotColor( 1, Green ) ;
SetPlotColor( 2, Green ) ;
end
else
begin
SetPlotColor( 1, Red ) ;
SetPlotColor( 2, Red ) ;
end ;

 

Thanks in advance

 

 

Partha223
Posted : Tuesday, March 13, 2018 9:24:15 PM
Registered User
Joined: 2/13/2018
Posts: 33

BTW this appeared in TSAC Jan 2017 on Page # 48

Bruce_L
Posted : Wednesday, March 14, 2018 12:39:31 PM


Worden Trainer

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

This isn't an implementation of the trading system that includes the limit or stops and tracks if you are currently in a position. With those exceptions, I think the following would be the long trigger.

C > AVGC50 AND XUP(2 * C, MAXH20 + MINL20) AND TrueInRow(TrueInRow(H < MAXH20, 104) < TrueInRow(L > MINL20, 104), 2) = 2

And the short trigger.

C < AVGC50 AND XDOWN(2 * C, MAXH20 + MINL20) AND TrueInRow(TrueInRow(H < MAXH20, 104) > TrueInRow(L > MINL20, 104), 2) = 2

I have sent you a copy of a chart containing my interpretation of the Mean Reversion indicator via TCMail. The same limitations apply in that it isn't actually an implementation of the trading system including limits, stops, and tracking if you are in a position or not. It only provides the high, low, midline trigger, moving average, long entry, and short entry. It will only work for TC2000 v17 or newer.

How to Receive Messages with TC Mail



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Partha223
Posted : Wednesday, March 14, 2018 1:08:02 PM
Registered User
Joined: 2/13/2018
Posts: 33

Thanks Bruce, It worked like a charm, appreciate your help & Support

King247
Posted : Sunday, March 18, 2018 12:20:27 PM
Registered User
Joined: 6/28/2017
Posts: 68

Bruce,

I tried adding the PCFs as plots to a chart and got interesting results. Please send me a copy of a chart containing your interpretation of the Mean Reversion indicator via TCMail.

Thanks!

King247
Posted : Monday, March 19, 2018 11:53:26 AM
Registered User
Joined: 6/28/2017
Posts: 68

Thanks for sending this, Bruce; and also thanks for your help with the indicators.

one100mil2016
Posted : Friday, March 30, 2018 4:15:02 PM
Registered User
Joined: 7/18/2016
Posts: 13

Hi Bruce,

Kindly send me a copy as well via TCMAIL

Regards

AJ

 

one100mil2016
Posted : Monday, April 9, 2018 12:19:47 PM
Registered User
Joined: 7/18/2016
Posts: 13

Thanks Bruce

raynd
Posted : Thursday, June 7, 2018 9:25:44 PM
Registered User
Joined: 5/11/2013
Posts: 17
Hi Bruce,Pls send me a chart with the Means Reversion Indicator. Tks
Al_Gorithm
Posted : Friday, June 8, 2018 10:54:32 AM

Registered User
Joined: 6/30/2017
Posts: 1,227

Happy Friday Bruce,

I'll take a copy via TCMail, please. I'm usually a mean reversion guy. Sounds interesting. Will pulll out my S&C collection and read the article, along with your comments above.

It'll give me something to chew on this weekend ... weather around here is iffy.

Thanks!

Al_Gorithm
Posted : Friday, June 8, 2018 12:32:11 PM

Registered User
Joined: 6/30/2017
Posts: 1,227

Thanks, Bruce. Enjoy your weekend!

Circle June 20th on your calendar. Larry Connors is releasing his latest book in a couple of weeks. He's always good for specific, objective, quantifiable algos. They're usually pretty simple to implement, but if I have any questions, you'll be the first to know.

Al_Gorithm
Posted : Friday, June 8, 2018 7:46:06 PM

Registered User
Joined: 6/30/2017
Posts: 1,227

Interesting. Finally got a few minutes to myself today, and read the article and the Traders' Tips section.

The January 2017 issue is a little unusual because the January 2017 Traders' Tips code is for Ken Calhoun's DECEMBER 2016 article, NOT for the January article on page 48 as mentioned above.

For those unfamiliar, Ken's December article covers swing-trading while the January article is about day-trading.

Since the barista shut me down today and I sadly have nothing better to do on a Friday night, LOL, I'm going to read the December article and look at the goodies Bruce TCMailed me. Lately my focus has been intraday trading but I'm open to swinging as much as the next guy ;)

<insert rimshot here>

Priyaa
Posted : Wednesday, February 6, 2019 2:18:04 PM
Registered User
Joined: 1/11/2019
Posts: 28
Can I please get this in TC Mail?
 
Thanks 
Bruce_L
Posted : Wednesday, February 6, 2019 2:21:44 PM


Worden Trainer

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

I have sent you a copy of a chart containing my interpretation of the Mean Reversion indicator via TCMail. It isn't actually an implementation of the trading system including limits, stops, and tracking if you are in a position or not. It only provides the high, low, midline trigger, moving average, long entry, and short entry (and can't use current traded statas as part of the entries). It will only work for TC2000 v18 or newer.



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