ana SuperTrend....... - EasyLanguage Programming | futures io social day trading
futures io futures trading


ana SuperTrend.......
Updated: Views / Replies:17,760 / 39
Created: by Serger Attachments:12

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 12  
 
Thread Tools Search this Thread
 

ana SuperTrend.......

  #1 (permalink)
Elite Member
Quebec
 
Futures Experience: Intermediate
Platform: Multicharts 64 +VolProfile
Broker/Data: AMP Trading / CQG
Favorite Futures: Ym, Es
 
Serger's Avatar
 
Posts: 72 since Oct 2010
Thanks: 64 given, 22 received

ana SuperTrend.......

are what anyone would be able to turn this fantastic
anaSuperTrend vertion in MC??
it is absolutely genial this indicator ....
thank you for your help in advance!

Reply With Quote
 
  #2 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received

I looked at the NT code for this and started to port the MovingMedian indicator to easy language first since anaSuperTrend depends on that. Can someone post a screenshot of the NT version on some daily chart so I can compare it?

Here's the function for moving median:

 
Code
inputs:
    Price(NumericSeries),
    length(NumericSimple);

variables: 
    int period(0),
    int idx(0),
    int meanIdx(0),
    int priorIdx(0),
    float MA(0.0);
    
Array: float mArray[](0);
    
if period < 1 then period = 1 else period = length; //throw some exception

Array_SetMaxIndex(mArray, period);

if currentbar < period then begin
    value1 = currentbar + 1;
    for idx = 0 to value1 - 1 begin  // inclusive?
        mArray[idx] = price[idx];
    end;
    value2 = SortArray(mArray,period,1);  //ascending?? should not matter since we're getting the median
    
    if mod(period, 2) = 0 then MA = 0.5 * (mArray[value1/2] + mArray[value1/2-1])
    else MA = mArray[(value1-1)/2];

end else begin

    for idx = 0 to period - 1 begin
        mArray[idx] = price[idx];
    end;
    value2 = SortArray(mArray,period,1);
    if mod(period, 2) = 0 then 
        MA = 0.5 * (mArray[period/2] + mArray[period/2-1])
    else
        MA = mArray[(period-1)/2];

end;

_MovingMedian = MA;
and the indicator. Nothing fancy like rising/falling colors.

 
Code
input: price(close),
        period(17);

Plot1(_MovingMedian(price, period), "MovMed");
This works in TradeStation.

I will try to make sense of the anaSuperTrend indicator next.

Regards,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
The following user says Thank You to cbritton for this post:
 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary



cbritton View Post
I looked at the NT code for this and started to port the MovingMedian indicator to easy language first since anaSuperTrend depends on that. Can someone post a screenshot of the NT version on some daily chart so I can compare it?

Here is a daily chart of the S&P 500 index with the anaSuperTrend applied. Let me know, if you need any help in understanding the code.

Attached Thumbnails
ana SuperTrend.......-sp500-daily-11_11_2010-25_05_2011.jpg  
Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received


Fat Tails View Post
Here is a daily chart of the S&P 500 index with the anaSuperTrend applied. Let me know, if you need any help in understanding the code.

Thanks! I'll try to have something to post later today or tomorrow.

-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
The following user says Thank You to cbritton for this post:
 
  #5 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received

Here's my first stab at it. I'm sure there are some things I did not do right, so pick it apart and make it better!

I coded this as a show me in TradeStation instead of an indicator. No real reason for that. I included the commentary block if you feel like you need to debug it for whatever reason. Just set debug to true (the default). The NT code logic did not translate well to EL, so I did some minor tweaking to make this work.

Attached is a screen shot of the show me applied to the daily SPY. The yellow "+" indicates the up/down arrows on the NT version.

 
Code
inputs:
    price(close),
    medianPeriod(5),
    atrPeriod(21),
    atrMultiplier(3),
    showStopLine(true),
    showArrows(true);

vars: 
      stopLine(0),
      upTrend(true), 
      currentUpTrend(true),
      color(0),
      newstop(0),
      priorStop(0), 
      priorcolor(0),
      MM(0),
      MAE(0),
      debug(true);

MM = _MovingMedian(price, medianPeriod);
MAE = _AvgTrueRange(atrPeriod);

// Define the rising/falling colors
if 1 = 0 then begin
    Plot1(close, "rising");
    Plot2(close, "falling");
end;

if CurrentBar = 0 then begin
    stopLine = close;
    upTrend = true;
end;

if close > stopLine[1] then begin
    upTrend = true;
    newStop = MM - atrMultiplier * MAE;
    currentUpTrend = true;

    if upTrend[1] = false then stopline = newStop
    else stopline = maxlist(newStop, stopline[1]);
    
end else if close < stopLine[1] then begin

    upTrend = false;
    newStop = MM + atrmultiplier * MAE;
    currentUpTrend = false;
    
    if UpTrend[1] = true then stopLine = newStop 
    else stopLine = minlist(newStop, StopLine[1]); 

end else begin

    upTrend = upTrend[1];
    currentUpTrend = upTrend;
    stopline = stopline[1];

end;


if debug = true then begin
    #beginCmtry
        CommentaryCL("*************************************************");
        CommentaryCL("MM: ", MM);
        CommentaryCL("MAE: ", MAE);
        CommentaryCL("close: " ,c);
        CommentaryCL("upTrend: ", upTrend);
        CommentaryCL("upTrend[1]: ", upTrend[1]);
        CommentaryCL("currentUpTrend: ", currentUpTrend);
        CommentaryCL("stopLine: ", stopLine);
        CommentaryCL("priorStop: ", priorStop);
        CommentaryCL("*************************************************");
    #End;
end;

if showArrows then begin
    value3 = MinMove/PriceScale;
    if currentUpTrend = true and upTrend[1]<> true then begin
    
        value2 = newStop - 2 * value3;
        Plot3(newStop - 2* value3, "Arrow down");
        
    end else if currentUpTrend <> true and upTrend[1]=true  then begin

        value2 = newStop + 2 * value3;
        Plot4(newStop + 2* value3, "Arrow up");
    end;

end;


if showStopLine then begin

    if UpTrend = true and upTrend[1] <> true then begin
        color = GetPlotColor(1); // up color
    end else if UpTrend = true then begin
        color = GetPlotcolor(1); // up Color
    end else if UpTrend <> true and upTrend[1]=true then begin
        color = GetPlotColor(2); // down color
    end else begin
        color = GetPlotColor(2); // down color
    end;
    
    Plot5(stopLine, "Stop Line", color);

end;
Regards,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Attached Thumbnails
ana SuperTrend.......-2011-05-27_13-27-31.png   ana SuperTrend.......-2011-05-27_13-27-58.png  
Reply With Quote
The following 2 users say Thank You to cbritton for this post:
 
  #6 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary

The result looks near correct. The Easy Language version seems to track price closer than the origianl version. However, when I checked the code, it looks correct. The only difference I found:

The anaSuperTrend uses the statistical Median of the Median[0], the latter being (High[0]+Low[0])/2. This means that the median is not calculated from the closes. I am not sure about the Easy Language version.

With the same parameters that you used, the NinjaTrader chart looks like this:

Attached Thumbnails
ana SuperTrend.......-sp500-daily-18_10_2010-26_05_2011.jpg  
Reply With Quote
 
  #7 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received

There's nothing interesting about ATR, so it's probably a difference in how the moving median is computed as far as these differences are concerned. Here's a screenshot of the indicator I posted earlier with a 10 period moving median on the daily close of SPY. Seems anyone can just pick a decent moving average indicator to base the ATR off of. A "pick your own" type of indicator like what we have around this site would allow people to adjust the super trend to their style.

Just my 0.02
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Attached Thumbnails
ana SuperTrend.......-2011-05-27_16-55-08.png  

Last edited by cbritton; May 27th, 2011 at 06:02 PM. Reason: wrong period
Reply With Quote
The following user says Thank You to cbritton for this post:
 
  #8 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary


cbritton View Post
There's nothing interesting about ATR, so it's probably a difference in how the moving median is computed as far as these differences are concerned. Here's a screenshot of the indicator I posted earlier with a 10 period moving median on the daily close of SPY. Seems anyone can just pick a decent moving average indicator to base the ATR off of. A "pick your own" type of indicator like what we have around this site would allow people to adjust the super trend to their style.

Just my 0.02
-C

But did you see that my indicator does not use Median(Close,n) but Median((High+Low)/2,n) ?

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #9 (permalink)
Elite Member
Atlanta, Georgia
 
Futures Experience: Intermediate
Platform: NT
Broker/Data: DDT
Favorite Futures: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 237 received


Fat Tails View Post
But did you see that my indicator does not use Median(Close,n) but Median((High+Low)/2,n) ?

Well I feel stupid now.

Here's my updated chart.

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Attached Thumbnails
ana SuperTrend.......-2011-05-27_17-44-38.png  
Reply With Quote
The following user says Thank You to cbritton for this post:
 
  #10 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary



cbritton View Post
Well I feel stupid now.

Here's my updated chart.

Looks good now. If it is not identical, it comes very close at least. I think you made it.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > > ana SuperTrend.......

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyLanguage SuperTrend indicator Big Mike EasyLanguage Programming 79 August 10th, 2016 04:34 AM
TS Supertrend gwaco Traders Hideout 14 November 21st, 2014 09:20 AM
Supertrend Strategy Help rpm123 NinjaTrader Programming 17 March 5th, 2012 03:27 PM
SuperTrend Needed. Please help. tickvix NinjaTrader 11 March 28th, 2011 04:33 PM
SuperTrend Panel 2 ceramictilepro NinjaTrader Programming 2 March 22nd, 2011 05:55 AM


All times are GMT -4. The time now is 04:40 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-18 in 0.08 seconds with 19 queries on phoenix via your IP 54.221.136.62