Traderji.com - Discussion forum for Stocks Commodities & Forex


Trading with TSMA (Trailing Stop Moving Average) System

Discuss Trading with TSMA (Trailing Stop Moving Average) System at the Advanced Trading Strategies within the Traderji.com - Discussion forum for Stocks Commodities & Forex; I had been working on couple of systems and back testing the results... here is ...


Go Back   Traderji.com - Discussion forum for Stocks Commodities & Forex > METHODS & STRATEGIES > Advanced Trading Strategies


Advanced Trading Strategies Discuss Advanced Trading Systems & Strategies.


Advertise Here

Reply
 
Thread Tools
  #1  
Old 22nd February 2010, 11:55 AM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Trading with TSMA (Trailing Stop Moving Average) System


I had been working on couple of systems and back testing the results... here is another such experimental system.

PLEASE DO NOT TRADE THIS SYSTEM AS THIS IS JUST FOR THE SAKE OF TESTING AND SUGGESTIONS TO MAKE IT BETTER.

What it is all about?
It is the simplest form of Moving Average system which does not look for a cross to enter the trade but compare the current bar's closing price and if the current price trade above the MA then its a Buy and if it comes below the MA then its a sell.

I have seen many MA systems and the biggest problem with them is that they are too slow in predicting the change in trend that mostly when you came to know that trend has changed its too late and you are near cost.


Basically this system is a fusion of these two previous experiments and try to compliment each other
MA System - http://www.traderji.com/options/3271...tml#post357626
Trailing Stop Loss System - http://www.traderji.com/futures/3567...tml#post386706


What is the strategy?
Get out of the winning trade on a first sign of reversal in trend and stay out with the cash.

How it works?
You choose a MA period... default is 21 (my favorite Fibo level and works best on most chart periods)
You choose a Shift period.. to decide the Training Stop Loss (idea taken from Nifty Technicals System)

Buy Setup: Current bar is third consecutive bar above MA(period)
Buy Stop: Last N bar's close price

Sell Setup: Current bar is third consecutive bar above MA(period)
Sell Stop: Last N bar's close price

Back tester's Settings



Parameters



System on Daily Chart of Nifty Futures


Last edited by findvikas; 22nd February 2010 at 12:26 PM.
Reply With Quote
The Following 4 Users Say Thank You to findvikas For This Useful Post:
4076699 (22nd February 2010), karin_jack (22nd February 2010), naveenvadavadagi (24th February 2010), Pralhad (22nd February 2010)
Sponsored Links
  #2  
Old 22nd February 2010, 11:55 AM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Trailing Stop Moving Average System's AFL

Last Updated: 2/24/2010


Quote:
_SECTION_BEGIN("TSMA System");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkGradientFill(colorWhite,colorRose,colorY ellow);

_N(Title = StrFormat("Vikas's Trailing Stop MA System - {{NAME}} - {{INTERVAL}} {{DATE}} \nOpen %g, \nHigh %g, \nLow %g, \nClose %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

M1 = MA(C,Param("MA",21,1));
shiftStop = Param("Shift Stop",3);

Buy = (C > M1) AND (Ref(C,-1) > M1) AND (Ref(C,-2) > M1);
BuyStop = Buy AND C<Ref(C,-shiftStop);

Sell = (C < M1) AND (Ref(C,-1) < M1) AND (Ref(C,-2) < M1);
SellStop = Sell AND C>Ref(C,-shiftStop);

Plot(M1,"\nMoving Average",colorTeal,styleThick);
Plot(Ref(C,-1),"\nPrevious Close",colorRed,styleNoDraw);
Plot(Ref(C,-2),"P2P Close",colorRed,styleNoDraw | styleNoDraw);
Plot(Ref(C,-shiftStop),"\nStop Loss",colorRed, styleDashed | styleThick | styleNoDraw);




Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
BuyStop = ExRem(BuyStop,SellStop);
SellStop = ExRem(SellStop,BuyStop);


Short = Sell;
Cover=Buy;

ChartStyle = styleCandle | styleThick | styleNoTitle;

PlotOHLC(O,H,L,C,Name(),colorDefault, ChartStyle);

// -- OK, let's plot the signals using arrows

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25);

PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25);


PlotShapes(IIf(BuyStop, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-10);
PlotShapes(IIf(SellStop, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-10);

// EXPLORATION CODE STARTS HERE
backColor = IIf( Buy, colorGreen,colorRed);

Filter = Buy OR Sell;
SetOption("NoDefaultColumns", True );
AddTextColumn(Name(), "Scrip",1.2,colorWhite,backColor ,80);
AddColumn(DateTime(), "Date" ,formatDateTime,colorWhite,backColor ,120);
AddColumn(IIf( Buy, 66, 83 ), "Signal", formatChar,colorWhite,backColor ,50);
AddColumn(C,"Trade Price",1.2,colorWhite,backColor ,80);
AddColumn(Ref(C,-shiftStop),"Stop",1.2,colorWhite,backColor ,80);


// EXPLORATION CODE ENDS HERE
_SECTION_END();

Last edited by findvikas; 24th February 2010 at 08:55 PM.
Reply With Quote
The Following 4 Users Say Thank You to findvikas For This Useful Post:
choudri (22nd February 2010), karin_jack (22nd February 2010), Pralhad (22nd February 2010), santoshkj (23rd February 2010)
  #3  
Old 22nd February 2010, 11:56 AM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Back testing Results

Common Parameters For All Tests:
Period: 1 Sep. 2008 - 19 Feb. 2010
Interval: Daily
Initial Capital: 10,000
MA Period: 21
Shift Stop: 3

Trade On Current Bar's Close price: Assuming trade is executed @ 3pm

Unitech



Reliance



Nifty Current Month Futures



DLF


Last edited by findvikas; 22nd February 2010 at 12:04 PM.
Reply With Quote
The Following 2 Users Say Thank You to findvikas For This Useful Post:
naveenvadavadagi (24th February 2010), Pralhad (22nd February 2010)
  #4  
Old 22nd February 2010, 12:06 PM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Like no system is perfect, this is also at very initial stage. I am trying to keep it as simple as possible that anyone can trade even without looking at AFL or opening AmiBroker as well.

It also has Exploration Feature and the output comes like this...

Reply With Quote
The Following 2 Users Say Thank You to findvikas For This Useful Post:
munnabhai208 (22nd February 2010), Pralhad (22nd February 2010)
  #5  
Old 22nd February 2010, 02:56 PM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Some problem in the AFL... its not closing my trades on the SL level when I do back testing... any AFL expert here?

Does not just setting BuyStop & SellStop work when running automated backtest?
Reply With Quote
  #6  
Old 22nd February 2010, 04:40 PM
Member
 
Join Date: Dec 2009
Posts: 68
Thanks: 168
Thanked 17 Times in 16 Posts
choudri is on a distinguished road
Wink Re: Trading with TSMA (Trailing Stop Moving Average) System

SUPERB THANKS FOR SHARING GOOD LUCK
Reply With Quote
  #7  
Old 22nd February 2010, 04:43 PM
Member
 
Join Date: Dec 2009
Posts: 68
Thanks: 168
Thanked 17 Times in 16 Posts
choudri is on a distinguished road
Wink Re: Trading with TSMA (Trailing Stop Moving Average) System

Quote:
Originally Posted by findvikas View Post
Trailing Stop Moving Average System's AFL

Last Updated: 2/22/2010
THIRD LINE OF THE CODE PLEASE AVOID THE SPACE IN Y ellow

correct it and read it as Yellow
Reply With Quote
The Following User Says Thank You to choudri For This Useful Post:
findvikas (22nd February 2010)
  #8  
Old 22nd February 2010, 05:09 PM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Its correct but the forum is not rendering it properly... nevermind I have attached the AFL to the Zip file.
Reply With Quote
  #9  
Old 22nd February 2010, 05:26 PM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

I am not sure how many of you are interested but I have created an Expert Advisor for automated trading FX based on this strategy. I am running the tests on a demo account and let you know the performance.

I am not sure if the script is created properly as I am very new to MQL... any MetaTrader expert here to verify my script?
Reply With Quote
  #10  
Old 22nd February 2010, 07:39 PM
findvikas's Avatar
Member
 
Join Date: Jan 2008
Posts: 3,298
Thanks: 1,103
Thanked 3,260 Times in 2,030 Posts
findvikas has a reputation beyond repute
findvikas has a reputation beyond reputefindvikas has a reputation beyond reputefindvikas has a reputation beyond repute
Default Re: Trading with TSMA (Trailing Stop Moving Average) System

Not every stock MUST perform similar with any system and likewise I was able to identify these few stocks which performed way too good with this system.

I would be tracking these stocks for any daily triggers and see how they perform.

ABAN.NS
ADLABSFILM.NS
ANDHRABAN.NS
ANSALINFR.NS
AUROPHARM.NS
BAJAJHIND.NS
BALRAMCHI.NS
BHUSANSTL.NS
BOMDYEING.NS
CENTRALBK.NS
CHENNPETR.NS
CMC.NS
CUMMINSIN.NS
GUJALKALI.NS
HAVELLS.NS
HDIL.NS
HINDZINC.NS
INDUSINDB.NS
IVRPRIME.NS
JETAIRWAY.NS
JPHYDRO.NS
KESORAMIN.NS
LAXMIMACH.NS
MAHSEAMLE.NS
MPHASIS.NS
NATIONALU.NS
NDTV.NS
NUCLEUS.NS
ORCHIDCHE.NS
PATELENG.NS
PATNI.NS
PENINLAND.NS
REDINGTON.NS
RELCAPITA.NS
SHREECEM.NS
STAR.NS
STRTECH.NS
SUZLON.NS
TATAMOTOR.NS
TATASTEEL.NS
UNITECH.NS
WELGUJ.NS
WIPRO.NS



All of them gave above 100% return.. some of them gave 300%-500% while 1 stock gave whopping 800% return



Last edited by findvikas; 22nd February 2010 at 07:45 PM.
Reply With Quote
The Following User Says Thank You to findvikas For This Useful Post:
naveenvadavadagi (24th February 2010)
Reply

Bookmarks


Advertise Here


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +5.5. The time now is 04:24 PM.

Indemnity, Disclaimer & Disclosure Notice:
• By visiting Traderji.com you automatically indicate that you agree to our Forum Rules, Indemnity, Disclaimer & Disclosure Notice and General Content Disclaimer Notice and indemnify Traderji.com, its associates and related parties of all claims howsoever resulting from the usage of the forum/site.
Disclaimer: Trading or investing in stocks & commodities is a high risk activity. Any action you choose to take in the markets is totally your own responsibility. You are recommended to make appropriate enquiries and seek appropriate advise before sending money, incurring any expenses, acting on recommendations or entering into any commitment in relation to any advertisement published here. Traderji.com does not vouch for any claims made by the advertisers of products and services. Traderji.com will not be held liable for any consequences in the event such claims are not honoured by the advertisers. Traderji.com will not be liable for any, direct or indirect, consequential or incidental damages or loss arising out of the use of any information by anybody mentioned anywhere on this site.
Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein. The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy or legality of any information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.
 


Copyright © 2001 - 2012, Traderji.com All Rights Reserved.

Recommended Websites - www.TradersEdgeIndia.com - www.TradingPicks.com - www.MasterOfTrading.com