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
|
|
Registered User Joined: 2/13/2018 Posts: 33
|
BTW this appeared in TSAC Jan 2017 on Page # 48
|
|
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
|
|
Registered User Joined: 2/13/2018 Posts: 33
|
Thanks Bruce, It worked like a charm, appreciate your help & Support
|
|
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!
|
|
Registered User Joined: 6/28/2017 Posts: 68
|
Thanks for sending this, Bruce; and also thanks for your help with the indicators.
|
|
Registered User Joined: 7/18/2016 Posts: 13
|
Hi Bruce,
Kindly send me a copy as well via TCMAIL
Regards
AJ
|
|
Registered User Joined: 7/18/2016 Posts: 13
|
Thanks Bruce
|
|
Registered User Joined: 5/11/2013 Posts: 17
|
Hi Bruce,Pls send me a chart with the Means Reversion Indicator. Tks
|
|
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!
|
|
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.
|
|
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>
|
|
Registered User Joined: 1/11/2019 Posts: 28
|
Can I please get this in TC Mail?
Thanks
|
|
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
|
|
Guest-1 |