NexusFi: Find Your Edge


Home Menu

 





Schaff Trend Cycle Indicator


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one nlenz with 5 posts (4 thanks)
    2. looks_two HectorPriamedes with 3 posts (0 thanks)
    3. looks_3 ABCTG with 2 posts (0 thanks)
    4. looks_4 wvl1211 with 2 posts (0 thanks)
    1. trending_up 20,428 views
    2. thumb_up 11 thanks given
    3. group 10 followers
    1. forum 21 posts
    2. attach_file 4 attachments




 
Search this Thread

Schaff Trend Cycle Indicator

  #11 (permalink)
nlenz
Haifa, Israel
 
Posts: 5 since Jun 2010
Thanks Given: 0
Thanks Received: 1


HectorPriamedes View Post
Hey never mind, I solved it. thanks anyways guys.

Would you be willing to share the results if they are good?

Thank you

p.s. I tried to reply to your PM and was denied due to having less than 5 posts.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #12 (permalink)
 
HectorPriamedes's Avatar
 HectorPriamedes 
OMAHA, NEBRASKA
 
Experience: Intermediate
Platform: MULTICHARTS + TOS
Broker: TRADESTATION + TOS
Trading: FUTURES
Posts: 23 since Sep 2011
Thanks Given: 29
Thanks Received: 30

The results are terrible thus far. However, I am willing to share in hopes that someone can improve on my work, and share back, that way we can all benefit.

As it is now, there is too much whipsawing with the Schaff and And TOS' backtesting format is not the best. I feel like the exit criteria should not necessarily be a reversal in the SCHAFF Cycle but maybe something else. In any event you play with it and post improvements. Here is how to send a short order when the SCHAFF fires short.

Add the following as a STRATEGY (not as a study)
Begin code:



input TCLen = 10;
input MA1 = 23;
input MA2 = 50;
def factor = 0.5;
input AverageType = {SMA, default EMA};
input TradeSize = 1;
input ShaffUpperLimit = 80;


# calculate the MACD
rec XMac = MACD(MA1, MA2, 9, AverageType).Value;

# 1st Stochastic: Calculate the Stochastic of a MACD
rec Value1 = Lowest(XMac, TCLen);
rec Value2 = Highest(XMac, TCLen) - Value1;

# %FastK of MACD
rec Frac1 = if Value2 > 0 then ((XMac - Value1) / Value2) * 100 else Frac1[1];

# smoothes calcuation for %FastD of MACD
rec PF = CompoundValue(1, PF[1] + (factor * (Frac1 - PF[1])), Frac1);

# 2nd stochastic: calculate stochastic of smoothed percent FastD, 'PF', above.
rec Value3 = Lowest(PF, TCLen);
rec Value4 = Highest(PF, TCLen) - Value3;

# %FastK of PF
rec Frac2 = if Value4 > 0 then ((PF - Value3) / Value4) * 100 else Frac2[1];

# smoothed calculation for %FastD of PF
rec PFF = CompoundValue(1, PFF[1] + (factor * (Frac2 - PFF[1])), Frac2);


def SchaffOutput= PFF;

def condition1 = SchaffOutput[1] < SchaffOutput[2];

def condition2 = SchaffOutput[2] > ShaffUpperLimit;


def x0 = condition1 and condition2;


AddOrder(OrderType.SELL_AUTO, x0, close[0], TradeSize, tickcolor = GetColor(0), arrowcolor = GetColor(0));



End Code.

That's for shorting. Go through the code and flip it for longs. I am still messing with the short side.

Please post improvements!

Reply With Quote
  #13 (permalink)
nlenz
Haifa, Israel
 
Posts: 5 since Jun 2010
Thanks Given: 0
Thanks Received: 1



HectorPriamedes View Post
The results are terrible thus far. However, I am willing to share in hopes that someone can improve on my work, and share back, that way we can all benefit.

As it is now, there is too much whipsawing with the Schaff and And TOS' backtesting format is not the best.

Please post improvements!

Thank you. I am not surprised, because many indicators which look great in theory fail when subjected to backtests.

Reply With Quote
  #14 (permalink)
jamesnettle
Carlsbad CA USA
 
Posts: 2 since Mar 2015
Thanks Given: 0
Thanks Received: 0

Hello Everyone!
I'm new hear.
I'm looking for the TOS code for the Schaff Trend Cycle indicator. No tweaks, no changes. I found one file / attachment called STCSTUDY.ts, but it wants to open in a media player. ??? I believe the thinkscript is just straight text.
Can anyone help? THANKS IN ADVANCE

Reply With Quote
  #15 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441


jamesnettle View Post
Hello Everyone!
I'm new hear.
I'm looking for the TOS code for the Schaff Trend Cycle indicator. No tweaks, no changes. I found one file / attachment called STCSTUDY.ts, but it wants to open in a media player. ??? I believe the thinkscript is just straight text.
Can anyone help? THANKS IN ADVANCE

Open a chart in thinkorswim, then go to Edit Studies and Strategies and select the Import on the bottom left, then select the file. You can also right click the file, Open With and select Notepad, copy the code, then in the Edit Studies and Strategies select New... and paste the code there.

Attached Thumbnails
Click image for larger version

Name:	import.png
Views:	226
Size:	75.7 KB
ID:	179471  
Reply With Quote
  #16 (permalink)
nlenz
Haifa, Israel
 
Posts: 5 since Jun 2010
Thanks Given: 0
Thanks Received: 1


jamesnettle View Post
Hello Everyone!
I'm new hear.
I'm looking for the TOS code for the Schaff Trend Cycle indicator. No tweaks, no changes. I found one file / attachment called STCSTUDY.ts, but it wants to open in a media player. ??? I believe the thinkscript is just straight text.
Can anyone help? THANKS IN ADVANCE

Hi James,

It won't work by double clicking. What you have to do is from within the TOS application open a chart, then in the "studies menu"->"edit studies..." a window will open and on the lower left of that window click "Import..." and finally navigate to the file on your computer from that TOS window and click "Open". After that the study will be available in the list of studies for usage.

Reply With Quote
  #17 (permalink)
jamesnettle
Carlsbad CA USA
 
Posts: 2 since Mar 2015
Thanks Given: 0
Thanks Received: 0


nlenz View Post
Hi James,

It won't work by double clicking. What you have to do is from within the TOS application open a chart, then in the "studies menu"->"edit studies..." a window will open and on the lower left of that window click "Import..." and finally navigate to the file on your computer from that TOS window and click "Open". After that the study will be available in the list of studies for usage.

Sir, you are a gentleman and a scholar. Followed your instructions and all went well.
Thank you. JIM

Reply With Quote
  #18 (permalink)
nlenz
Haifa, Israel
 
Posts: 5 since Jun 2010
Thanks Given: 0
Thanks Received: 1


jamesnettle View Post
Sir, you are a gentleman and a scholar. Followed your instructions and all went well.
Thank you. JIM

You are welcome - glad it worked out. And thank you for the compliment

Reply With Quote
  #19 (permalink)
wvl1211
Sydney NSW Australia
 
Posts: 3 since Jul 2017
Thanks Given: 0
Thanks Received: 1

Hi - hoping someone can help me out with this code below -
Question In "rec Frac1 = if Value2 > 0 then ((XMac - Value1) / Value2) * 100 else Frac1[1];
What is "Frac1[1]"
Question again in "rec PF = CompoundValue(1, PF[1] + (factor * (Frac1 - PF[1])), Frac1);
What is PF[1]? and also same with Frac2[1] and PFF[1]?????? where do I get those values from? does the bracket [] just mean default the Frac1 value to 1 if Value2<=0 and so on with the others?

Would appreciate some assistance with this
Will V L

input TCLen = 10;
input MA1 = 23;
input MA2 = 50;
def factor = 0.5;
input AverageType = {SMA, default EMA};
input TradeSize = 1;
input ShaffUpperLimit = 80;


# calculate the MACD
rec XMac = MACD(MA1, MA2, 9, AverageType).Value;

# 1st Stochastic: Calculate the Stochastic of a MACD
rec Value1 = Lowest(XMac, TCLen);
rec Value2 = Highest(XMac, TCLen) - Value1;

# %FastK of MACD
rec Frac1 = if Value2 > 0 then ((XMac - Value1) / Value2) * 100 else Frac1[1];

# smoothes calcuation for %FastD of MACD
rec PF = CompoundValue(1, PF[1] + (factor * (Frac1 - PF[1])), Frac1);

# 2nd stochastic: calculate stochastic of smoothed percent FastD, 'PF', above.
rec Value3 = Lowest(PF, TCLen);
rec Value4 = Highest(PF, TCLen) - Value3;

# %FastK of PF
rec Frac2 = if Value4 > 0 then ((PF - Value3) / Value4) * 100 else Frac2[1];

# smoothed calculation for %FastD of PF
rec PFF = CompoundValue(1, PFF[1] + (factor * (Frac2 - PFF[1])), Frac2);

Reply With Quote
  #20 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,627


wvl1211,

take a look at chapter 1 in the TOS Learning Center, it explains what [1] will do:
Learning Center - Chapter 1. Defining Variables

Regards,

ABCTG


wvl1211 View Post
Hi - hoping someone can help me out with this code below -
Question In "rec Frac1 = if Value2 > 0 then ((XMac - Value1) / Value2) * 100 else Frac1[1];
What is "Frac1[1]"
Question again in "rec PF = CompoundValue(1, PF[1] + (factor * (Frac1 - PF[1])), Frac1);
What is PF[1]? and also same with Frac2[1] and PFF[1]?????? where do I get those values from? does the bracket [] just mean default the Frac1 value to 1 if Value2<=0 and so on with the others?

Would appreciate some assistance with this
Will V L


Follow me on Twitter Reply With Quote




Last Updated on July 26, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts