Big Mike's Trading Forum
 

Go Back   Big Mike's Trading Forum

> Trading Forums > Platforms and Indicators > TradeStation > EasyLanguage Programming


Notices
     

EasyLanguage SuperTrend indicator
Started:March 25th, 2010 (03:01 AM) by Big Mike Views / Replies:31,505 / 75
Last Reply:September 17th, 2013 (10:42 AM) Attachments:9

Welcome to Big Mike's Trading Forum.

Welcome, Guest!

This forum was established to help traders by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

BMT is fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.


You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike
     

Reply
 9  
 
Thread Tools Search this Thread

EasyLanguage SuperTrend indicator

Old March 25th, 2010, 03:01 AM   #1 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 31,112 since Jun 2009
Thanks: 20,713 given, 38,004 received

EasyLanguage SuperTrend indicator

Here is my version of a TradeStation/MultiCharts EasyLanguage SuperTrend indicator.

I made it a function so it could be called easily from a strategy.

Function:
 
Code
			
// SuperTrend function 
// March 25 2010
// Big Mike https://www.bigmiketrading.com

inputs
ATRLength(NumericSimple), ATRMult(NumericSimple), Strength(NumericSimple), STrend(NumericRef);

vars
ATR(0), 
avg(0), 
dn(0), 
up(0), 
trend(1), 
flag(0), 
flagh(0), 
ST(0),
hl(0); 


hl Highest(HighATRLength) - Lowest(LowATRLength);
ATR XAverage(hlATRLength);
avg = (XAverage(highStrength) + XAverage(lowStrength))/2;
up avg ATR
dn avg ATR

if 
up[1] and Highest(HighStrength)[1then
trend 
1
else if dn[1] and Lowest(LowStrength)[1then
trend 
= -1;


if 
trend and trend[1] > 0 then flag=else flag=0
if 
trend and trend[1] < 0 then flagh else flagh 0

if 
trend and dn dn[1then dn=dn[1];
if 
trend and up up[1then up=up[1];

if 
flag 1 then up avg ATR
if 
flagh 1 then dn avg ATR

if 
trend 1 then ST dn else ST up;
SuperTrend ST;
STrend trend
Please note, on my version I use personally, the line "avg = (XAverage(high, Strength) + XAverage(low, Strength))/2;" from above function uses a Jurik-like phased moving average, not XAverage(EMA). But I haven't posted that yet, so I just made this use XAverage instead. Replace with your favorite MA.

Indicator:
 
Code
			
// SuperTrend indicator
// March 25 2010
// Big Mike https://www.bigmiketrading.com 

inputs
ATRLength(9), ATRMult(1), Strength(9);

vars
strend(0),
st(0);

st SuperTrend(ATRLengthATRMultStrengthstrend);

Plot1(st,"Up");
Plot2(st,"Down");
Plot3(st,"SuperTrend",iff(strend 1,GetPlotColor(1),GetPlotColor(2))); 
To get the desired Indicator effect and control over plot colors that I wanted, I made Plot1 and Plot2 a real plot so you could precisely control the RGB color. You need to mark these plots as invisible once you setup the indicator! I will provide a screen shot below as an example.

Plot3 is the real plot, and it will be colored based on if trend is up or down.

Please register to view the post attachment(s), image(s), or screenshot(s) - it's simple and free.


Here are some example screenshots:

Please register to view the post attachment(s), image(s), or screenshot(s) - it's simple and free.


Please register to view the post attachment(s), image(s), or screenshot(s) - it's simple and free.


Please register to view the post attachment(s), image(s), or screenshot(s) - it's simple and free.


Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
     

Old March 25th, 2010, 03:01 AM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

     

Old March 26th, 2010, 12:43 AM   #3 (permalink)
Member
Omaha, NE
 
Trading Experience: Intermediate
Platform: OpenECry Trader
Broker/Data: InfinityAT/OEC
Favorite Instrument: Forex Futures
 
daedalus's Avatar
 
Posts: 46 since Nov 2009
Thanks: 15 given, 24 received


Is the name of the function "SuperTrend"?

In OEC we have to combine functions and indicator code into the same file and call the functions manually. Can't get her to compile using SuperTrend as the function name.... is this correct?

Reply With Quote
     

Old March 26th, 2010, 12:45 AM   #4 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 31,112 since Jun 2009
Thanks: 20,713 given, 38,004 received


daedalus View Post
Is the name of the function "SuperTrend"?

In OEC we have to combine functions and indicator code into the same file and call the functions manually. Can't get her to compile using SuperTrend as the function name.... is this correct?

Yes, function name is SuperTrend.

I'm not sure about OEC sorry. If you have to combine them, try taking the function code but using the indicator inputs, then add the plots.. more or less.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
     

Old March 26th, 2010, 12:48 AM   #5 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 31,112 since Jun 2009
Thanks: 20,713 given, 38,004 received

Attached is a MultiCharts pla which includes the SuperTrend function, SuperTrend indicator, at the Hull Moving Average I was using. You can replace the Mov Avg (jtHMA) with whatever floats your boat.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Attached Files
Register to download File Type: pla BMT SuperTrend.pla (9.3 KB, 499 views)
Reply With Quote
     
The following 9 users say Thank You to Big Mike for this post:
     

Old April 1st, 2010, 09:10 AM   #6 (permalink)
Just starting out...
 
Trading Experience: Master
Platform: ...
 
Posts: 1 since Feb 2010
Thanks: 1 given, 0 received

[...]
[...]
[...]
[...]


Last edited by frathom; April 4th, 2010 at 06:00 AM.
Reply With Quote
     

Old July 5th, 2010, 02:12 PM   #7 (permalink)
Just starting out...
clifton, nj
 
Trading Experience: Intermediate
Platform: TOS, Infinity
Favorite Instrument: ES, 6E
 
Posts: 2 since Jul 2010
Thanks: 1 given, 2 received

Mike-

when does the ATR Mult come into play?



thanks

-Steve

Reply With Quote
     
The following user says Thank You to factory15 for this post:
     

Old July 5th, 2010, 02:42 PM   #8 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 31,112 since Jun 2009
Thanks: 20,713 given, 38,004 received


factory15 View Post
Mike-

when does the ATR Mult come into play?



thanks

-Steve

It doesn't, was a bug in the code I listed above. You just need to modify:
 
Code
			
up avg + (ATR*ATRMult); 

dn avg - (ATR*ATRMult); 
If you want to add it.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
     
The following user says Thank You to Big Mike for this post:
     

Old July 5th, 2010, 04:03 PM   #9 (permalink)
Just starting out...
clifton, nj
 
Trading Experience: Intermediate
Platform: TOS, Infinity
Favorite Instrument: ES, 6E
 
Posts: 2 since Jul 2010
Thanks: 1 given, 2 received

Thanks Mike...

if you dont mind me asking- as a CL guy, what numbers do you plug in for ATRLength and Strength typically? Do you find it works pretty well?

I converted this over to thinkscript and I think I've got it working...anxious to see it in action.

thanks again

Reply With Quote
     
The following user says Thank You to factory15 for this post:
     

Old July 5th, 2010, 06:01 PM   #10 (permalink)
Administrator: 'da Big Dawg
Manta, Ecuador
 
Trading Experience: Advanced
Platform: My own custom solution
Favorite Instrument: SP500, Stocks
 
Big Mike's Avatar
 
Posts: 31,112 since Jun 2009
Thanks: 20,713 given, 38,004 received



factory15 View Post
Thanks Mike...

if you dont mind me asking- as a CL guy, what numbers do you plug in for ATRLength and Strength typically? Do you find it works pretty well?

I converted this over to thinkscript and I think I've got it working...anxious to see it in action.

thanks again

I don't use indicators in my trading, sorry. But the defaults of the script were probably what I used when I wrote it.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
     
The following 4 users say Thank You to Big Mike for this post:
     

Reply



Tags
%r, ai, algorithm, amp, anasupertrend, atr, ats, automated, bars, big mike, brokers, buy sell, change, chart, charts, cl, close, code, color, colors, combine, compile, control, create, day, development, direction, dow, easy language, easylanguage, el, eld, ema, entry, equity curve, error, es, fastbrokers, favourite, file, fill, flag, format, free, function, functions, future, high, hma, hull, import, index, india, indicator, indicators, instrument, jurik, language, line, load, lot, love, low, market, mind, ml, modify, moving average, multicharts, neoticker, newbie, ninja, note, oec, onstartup, order, period, plot, price, price_action, profit, programming, prorealtime, pullbacks, purpose, puts, question, reverse, script, settings, setup, signal, signals, start, stop, strategies, strategy, strength, supertrend, targets, testing, thank you, thinkscript, tick, time, trader, trades, tradestation, trading, trend, trend following, trend line, txt, update, var
     

Big Mike's Trading Forum > Trading Forums > Platforms and Indicators > TradeStation > EasyLanguage Programming > EasyLanguage SuperTrend indicator

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyLanguage ADXVMA Indicator Big Mike EasyLanguage Programming 12 June 5th, 2012 05:10 PM
Error with recoded Supertrend Line for EasyLanguage DarrenH EasyLanguage Programming 3 February 5th, 2011 12:05 PM
NinjaTrader indicator SuperTrend + audio alerts ojwright NinjaTrader 6 July 29th, 2010 01:54 AM
EasyLanguage ZeroLagEMA indicator Big Mike EasyLanguage Programming 1 April 10th, 2010 01:16 PM
EasyLanguage ZeroLagWMA indicator Big Mike EasyLanguage Programming 1 April 10th, 2010 01:09 PM


All times are GMT -4. The time now is 09:02 AM.

Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2014 by Big Mike Trading. 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.
 
no new posts

Page generated 2014-04-16 in 0.33 seconds with 20 queries on phoenix via your IP 54.204.66.38