EasyLanguage SuperTrend indicator - EasyLanguage Programming | futures io social trading
futures io futures trading


EasyLanguage SuperTrend indicator
Updated: Views / Replies:52,716 / 79
Created: by Big Mike Attachments:9

Welcome to futures io.

Welcome, Guest!

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

We are 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

  #61 (permalink)
Trading Apprentice
London
 
Futures Experience: Intermediate
Platform: Multicharts
Favorite Futures: Forex
 
Posts: 14 since Jan 2013
Thanks: 0 given, 3 received


Big Mike View Post
Gotcha.

The strend var is the key if i remember, monitor it for a change = if I remember it is 1 for long, -1 for short, so you could do something like:

if strend = 1 and strend[1] <> 1 then buy 1 contract next bar at market;

Mike

Mike - just adding my thanks to this old thread - I was able to get a Supertrend function up and running in MC with this post. It's my favourite indicator from a prorealtime past so v grateful for this.

Reply With Quote
 
  #62 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 45 since Jul 2013
Thanks: 27 given, 9 received


Big Mike View Post
Gotcha.

The strend var is the key if i remember, monitor it for a change = if I remember it is 1 for long, -1 for short, so you could do something like:

if strend = 1 and strend[1] <> 1 then buy 1 contract next bar at market;

Mike

I cannot replicate this unfortunately. The Signal does not open Positions.


Quoting 
Inputs:

smalength ( 200 ),
emalength ( 50 ),
ATRLength ( 30 ),
ATRMult ( 10 ),
Strength ( 30 ),

Variables:

smav ( 0 ),
emav ( 0 ),
vSuperTrend ( 0 ),
strend ( 0 );

// Call MAs
smav = Average(Close, smalength);
emav = XAverage(Close, emalength);

// Call Supertrend
vSuperTrend = SuperTrend(ATRLength, ATRMult, Strength, vSTrend);

// Open new positions (Long Only)

if marketposition = 0 then begin // Only open new positions if flat

if close > vSuperTrend then begin // Checks if Supertrend is below price action

end;

// EMA and SMA Both Rising & Supertrend switches from Red to Green
if smav > smav[1] and emav > emav[1] and emav > smav
and sTrend = 1 and sTrend[1] <> 1 then begin

Buy ("Enter Long") 1 Contracts Next Bar At Market;

end;

end;


Reply With Quote
 
  #63 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 45 since Jul 2013
Thanks: 27 given, 9 received


Anyone help for this?

Reply With Quote
 
  #64 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,325 since Apr 2013
Thanks: 211 given, 751 received

The variable strend is never assigned a value, except the initial 0.
So your condition
 
Code
sTrend = 1 and sTrend[1] <> 1
can never become true.

Should it be
 
Code
vsTrend = 1 and vsTrend[1] <> 1
?

Regards,
ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #65 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 45 since Jul 2013
Thanks: 27 given, 9 received

Hi ABC,

I referred to BigMike's post #22 on Page 3.

I would like to code a Buy/Sell signal for Supertrend crossings.

In Ninjatrader I did it through the following:


Quoting 
// Condition set 1
if (anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[1] > Close[1]
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[0] < Close[0])
{
EnterLong(RiskSize, "Buy Long");
}

// Condition set 2
if (Position.Quantity > 0
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[1] < Close[1]
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[0] > Close[0])
{
ExitLong("Exit Long", "");
}

It works fine, but for Easy Language, I somehow don't get it

Reply With Quote
 
  #66 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,325 since Apr 2013
Thanks: 211 given, 751 received

Hi sagetrade,

to check for a crossing is quite easy in EasyLanguage.
For an upcross you can do it like this:
 
Code
if MyVariable crosses over MyVariable[1]
or like this:
 
Code
if MyVariable > MyVariable[1] and MyVariable[1] < MyVariable[2]
or
 
Code
if MyVariable > MyVariable[1] and MyVariable[1] <= MyVariable[2]
depending on what you want.

For your code it makes a difference on the variable you want to use. Both sTrend and vSuperTrend are able to accomplish the task.
If you want to use vSuperTrend, then check for the cross. With sTrend you simply need to check for
 
Code
if sTrend = 1 and sTrend[1] = -1
Regards,
ABCTG


sagetrade View Post
Hi ABC,

I referred to BigMike's post #22 on Page 3.

I would like to code a Buy/Sell signal for Supertrend crossings.

In Ninjatrader I did it through the following:



It works fine, but for Easy Language, I somehow don't get it


Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #67 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 45 since Jul 2013
Thanks: 27 given, 9 received


ABCTG View Post
For your code it makes a difference on the variable you want to use. Both sTrend and vSuperTrend are able to accomplish the task.
If you want to use vSuperTrend, then check for the cross. With sTrend you simply need to check for
 
Code
if sTrend = 1 and sTrend[1] = -1

thx so much ABC once again. Can you explain where the specific difference between variables vSuperTrend & sTrend is?

Reply With Quote
 
  #68 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,325 since Apr 2013
Thanks: 211 given, 751 received

The vSuperTrend carries the value of the Supertrend and sTrend carries the direction of the Supertrend indicator.
This will become clear if you plot both variables. On this image the blue line is vSuperTrend and the red line is displaying the value of sTrend.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).



Regards,
ABCTG

Reply With Quote
The following user says Thank You to ABCTG for this post:
 
  #69 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 45 since Jul 2013
Thanks: 27 given, 9 received

But why do I need this sTrend variable at all?

When I look at my NinjaCode...


Quoting 
// Condition set 1
if (anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[1] > Close[1]
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[0] < Close[0])
{
EnterLong(RiskSize, "Buy Long");
}

// Condition set 2
if (Position.Quantity > 0
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[1] < Close[1]
&& anaSuperTrendM11(ATRStrength, ATRMult, ATRPeriod, false).StopDot[0] > Close[0])
{
ExitLong("Exit Long", "");
}

...there is no sTrend at all - just these three ATR variables.

Reply With Quote
 
  #70 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,325 since Apr 2013
Thanks: 211 given, 751 received


You don't need it. The easiest thing is to just leave it in there, if you don't want to use it. You just have to use it as input of the function.
Otherwise delete the input and get rid of it within the code. This will leave you with the three ATR inputs to the function.

Regards,
ABCTG

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

Reply



futures io > > > > > EasyLanguage SuperTrend indicator

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

FIO Journal Challenge featuring NinjaTrader ($2,000+ of prizes)

May
 

Prototyping Python Strategies (part 2: Backtesting) w/Ran Aroussi [special time: 1PM ET]

Elite only
 

Portfolio Diversification w/Brendon Delate @ Diversify Portfolio

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyLanguage ADXVMA Indicator Big Mike EasyLanguage Programming 15 October 29th, 2014 09:51 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 12:00 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-05-24 in 0.12 seconds with 20 queries on phoenix via your IP 54.146.5.196