NexusFi: Find Your Edge


Home Menu

 





EasyLanguage SuperTrend indicator


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Big Mike with 11 posts (59 thanks)
    2. looks_two ABCTG with 9 posts (6 thanks)
    3. looks_3 chtangwin with 6 posts (26 thanks)
    4. looks_4 Eiji with 5 posts (1 thanks)
      Best Posters
    1. looks_one Big Mike with 5.4 thanks per post
    2. looks_two chtangwin with 4.3 thanks per post
    3. looks_3 cedar with 1.3 thanks per post
    4. looks_4 ABCTG with 0.7 thanks per post
    1. trending_up 97,157 views
    2. thumb_up 103 thanks given
    3. group 42 followers
    1. forum 86 posts
    2. attach_file 9 attachments




 
Search this Thread

EasyLanguage SuperTrend indicator

  #41 (permalink)
 chtangwin 
NJ
 
Experience: Beginner
Platform: NinjaTrader
Posts: 7 since May 2010
Thanks Given: 2
Thanks Received: 26

Hi cedar,

That's a nice modification of the code. Or, you can set style to point (see pic below).

Can you explain what signal you use or find useful? I tried strategies mainly use superTrend for entry.
Just as you said, it catches the major trend, but also a lot false entries. It could not be used in real trading at this point.

Thanks.

Attached Thumbnails
Click image for larger version

Name:	superTrend.png
Views:	780
Size:	13.2 KB
ID:	54169  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
67 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
Battlestations: Show us your trading desks!
43 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #42 (permalink)
cedar
New York
 
Posts: 44 since May 2011
Thanks Given: 12
Thanks Received: 30


chtangwin View Post

Can you explain what signal you use or find useful? I tried strategies mainly use superTrend for entry.
Just as you said, it catches the major trend, but also a lot false entries. It could not be used in real trading at this point.

good to hear from you chtangwin.

What I find useful, is once the 'Trend' is identified by superTrend. Then use an oscillator(CCI, Stochastic, %R etc) to take trades in the direction of the trend. So essentially we are buying/selling pullbacks in the direction of the trend.

As a quick exmaple, in the attachement below, I put on a 12 period CCI.

As you know it takes rigorous testing to take a strategy from an idea to production. very few things pan out. I find using wide stops and proper profit targets, help quite a bit for intraday trading.

Attached Thumbnails
Click image for larger version

Name:	Nov 5.bmp
Views:	929
Size:	1.49 MB
ID:	54176  
Reply With Quote
  #43 (permalink)
 chtangwin 
NJ
 
Experience: Beginner
Platform: NinjaTrader
Posts: 7 since May 2010
Thanks Given: 2
Thanks Received: 26


Thanks a lot! Initial test shows a downward equity curve though, will look more into it.

Reply With Quote
  #44 (permalink)
 Eiji 
San Diego CA, USA
 
Experience: Beginner
Platform: TradeStation
Trading: YM
Posts: 22 since Jan 2012
Thanks Given: 12
Thanks Received: 5

Hi All,

My first post here. What a great place! I loaded the TCanasupertrend with the mod and switched the line to dots. I would like to change it to be just one row of dots in a flat line at the bottom or top of the charts so it doesnt muck up the view of price action. Anyone care to share how to add that in the EL code.

Thanks so much for all your efforts here.

Eiji


cedar View Post
While one will go broke taking every signal, I find the various forms of superTrend are great as a trend 'filter'. Can be easily used in strategies.

So once Trend is identified, take signals(some other method) in the direction of SuperTrend.

A slight modification to the anaSuperTrend code. The following will generate just one line and switch colors.

 
Code
 
{if currentUpTrend = true  then begin
 plot1(stopDot, "UpStopDot");
end;
if currentUpTrend = false then begin
 plot2(stopDot, "DnStopDot");
end;}
 
Plot1(stopDot);
 
If close > stopDot Then 
SetPlotColor(1,Green)else 
  SetPlotColor(1,magenta);


Visit my NexusFi Trade Journal Reply With Quote
  #45 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


Eiji View Post
I loaded the TCanasupertrend with the mod and switched the line to dots. I would like to change it to be just one row of dots in a flat line at the bottom or top of the charts so it doesnt muck up the view of price action. Anyone care to share how to add that in the EL code.

Where can we find the code for the TCanasupertrend indicator? (I couldn't find it here on futures.io (formerly BMT)) And what does 'with the mod' mean?

It would be hard to change the EasyLanguage code to what you want without something to start with.

Reply With Quote
  #46 (permalink)
 Eiji 
San Diego CA, USA
 
Experience: Beginner
Platform: TradeStation
Trading: YM
Posts: 22 since Jan 2012
Thanks Given: 12
Thanks Received: 5

Jura,
here is the code for the TCanaSupertrend

inputs:
PeriodMedian(3),
PeriodATR(3),
Multiplier(2);

variables:
priceMedian(0),
upTrend(true),
priorUpTrend(true),
currentUpTrend(true),
stopDot(0),
priorStop(0),
newStop(0),
offset(0);

priceMedian = 0.5 * (high + low);
if currentbar = 1 then begin
upTrend = true;
stopDot = close;
end
else begin
// FirstTickOfBar
priorUpTrend = upTrend[1];
priorStop = stopDot[1];
offset = AvgTrueRange(periodATR)[1];

if close > priorStop then begin
upTrend = true;
currentUpTrend = true;
newStop = _TC_anaMovingMedian(priceMedian, periodMedian) - multiplier * offset;
if priorUpTrend = false then
stopDot = newStop
else
stopDot = maxlist(newStop, priorStop);
end
else if close < priorStop then begin
upTrend = false;
currentUpTrend = false;
newStop = _TC_anaMovingMedian(priceMedian, periodMedian) + multiplier * offset;
if priorUpTrend = true then
stopDot = newStop
else
stopDot = minlist(newStop, priorStop);
end
else begin
upTrend = priorUpTrend;
currentUpTrend = priorUpTrend;
stopDot = priorStop;
end;
end;



{if currentUpTrend = true then begin
plot1(stopDot, "UpStopDot");
end;
if currentUpTrend = false then begin
plot2(stopDot, "DnStopDot");
end;}

Plot1(stopDot);

If close > stopDot Then
SetPlotColor(1,Green)else
SetPlotColor(1,red);



I would love just a single row of dots instead of it being plotted above and below the price action. Any help would be greatly appreciated.

Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to Eiji for this post:
  #47 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


Eiji View Post
here is the code for the TCanaSupertrend

(...)

Hi Eiji,

Your code uses a function called _TC_anaMovingMedian, for example here:

 
Code
newStop = _TC_anaMovingMedian(priceMedian, periodMedian) + multiplier * offset;
What's the code for this function? Or do you want to substitute that for something else?

Tip: add the pasted code between [ code ] and [ / code ] tags for better formatting (the # in the text box).

Reply With Quote
  #48 (permalink)
 Eiji 
San Diego CA, USA
 
Experience: Beginner
Platform: TradeStation
Trading: YM
Posts: 22 since Jan 2012
Thanks Given: 12
Thanks Received: 5

Jura,


Thanks for replying, Im not sure what you are asking. I grabbed the code from an earlier post on this thread and added the modification from another post. the code plots a line changing color from red to green , above and below price action on the chart. I like the signals and in the least it is a great filter, but do not like that it obscures the view and busies up the screen.
Im not a programmer but have figured out how to paste copied text into the EL development to create the file and get it to work. Other than that Im just guessing.

Visit my NexusFi Trade Journal Reply With Quote
  #49 (permalink)
 Eiji 
San Diego CA, USA
 
Experience: Beginner
Platform: TradeStation
Trading: YM
Posts: 22 since Jan 2012
Thanks Given: 12
Thanks Received: 5

Anyone?

Visit my NexusFi Trade Journal Reply With Quote
  #50 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690



Eiji View Post
Anyone?

What I'd do is set the indicator to a separate panel (so not 'Same as Symbol' as found in the properties of the indicator), then change the lines from 'Line' to 'Histogram', give these a fixed value (like 10), and change the width so you'll have tick Histogram bars. Lastly, use SetPlotColor() to change the color of the Histogram plot depending on what your definition of 'bulish/uptrend' versus 'bearish/downtrend' is. Then you'll have a separate panel below your chart which shows you the trend/direction, without messing up the price.

Since I can't get the indicator to work here without the function, you'll probably have to do this for yourself.

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





Last Updated on October 31, 2021


© 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