Help with SuperTrend input - EasyLanguage Programming | futures io social day trading
futures io futures trading


Help with SuperTrend input
Updated: Views / Replies:456 / 6
Created: by davidcolin Attachments:0

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
 
Thread Tools Search this Thread
 

Help with SuperTrend input

  #1 (permalink)
Trading Apprentice
Vancouver BC Canada
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Help with SuperTrend input

Hello,

I'm not an EasyLanguage expert but I do have some(very) basic knowledge. I am trying to plot a custom ShowMe based on the SuperTrend user function (appended below). For the life of me I cannot figure out what the final input (strend) is supposed to be. When I plot the indicator SuperTrend there is no input for strend, only for ATRLength, ATRmult and Strength. I just want red dots when C < Supertrend and green if vice versa but I can't plot this without this final input. Driving me nuts. Any help would be appreciated.

I've appended the indicator code as well.

Dave

SuperTrend Function:

// SuperTrend function

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(High, ATRLength) - Lowest(Low, ATRLength);
ATR = XAverage(hl, ATRLength);
avg = (XAverage(high, Strength) + XAverage(low, Strength))/2;
up = avg + ATR;
dn = avg - ATR;

if c > up[1] and c > Highest(High, Strength)[1] then
trend = 1
else if c < dn[1] and c < Lowest(Low, Strength)[1] then
trend = -1;


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

if trend > 0 and dn < dn[1] then dn=dn[1];
if trend < 0 and up > up[1] then 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;



SuperTrend Indicator:

// SuperTrend indicator

inputs:
ATRLength(10), ATRMult(1), Strength(10);

vars:
strend(0),
st(0);

st = SuperTrend(ATRLength, ATRMult, Strength, strend);

Plot1(st,"Up");
Plot2(st,"Down");
Plot3(st,"SuperTrend",iff(strend = 1,GetPlotColor(1),GetPlotColor(2)));

Reply With Quote
 
  #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.

 
  #3 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,455 since Apr 2013
Thanks: 222 given, 830 received


davidcolin,

welcome to futures.io. When you are working in the Tradestation development environment (or in Multicharts's PL Editor for that matter) you can highlight a reserved word and press F1, this will bring up an explanation of this word does.

NumerifRef is used to reference values back from a function, meaning you don't pass anything into the function using this input, but you can use it to receive a value. In your case of of the supertrend it just references +1 or -1 depending on the trend being up or down. You can use a simple numeric variable to hold what the function references back via STrend, but you don't have to use this variable later in your code.

By the way you can show your appreciation for a post here on Futures.io using the "Thanks" button under it.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #4 (permalink)
Trading Apprentice
Vancouver BC Canada
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

Hello ABCTG,

Thank you for answering my recent forum post re: the variable required to use the supertrend function. Unfortunately, not really having a programming background, I didn't even understand your answer. And now I am running into the same problem with a function for donchian channels. I want to use this function and I know what to enter for the inputs, however it seems to want me to enter something for the variables. Would you be able to tell me what I need to enter to use this function properly? Thanks and sorry to bother you. I'm not sure who else to ask.

Code is:


inputs:
period (NumericSimple),
myMid (NumericRef),
myUpper (NumericRef),
myLower (NumericRef),
upperPrice (NumericSeries),
lowerPrice (NumericSeries);


myUpper = Highest(upperPrice, period);
myLower = Lowest(lowerPrice, period);
myMid = (myUpper + myLower) / 2;


David

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

David,

I am sorry, but I don't understand what you mean with "it seems to want me to enter something for the variables". Your code snippet only shows inputs and no variables, so it's not really clear what you mean.

For the inputs you can see that you have three NumericRef inputs, so these will return values to the indicator (signal or function) calling your function.

Then you have "period" that sets the lookback length for the Highest and Lowest function and you have the price inputs for the Highest and Lowest function i.e. upperPrice and lowerPrice. The latter two are probably something like High or Low.

Regards,

ABCTG




davidcolin View Post
Hello ABCTG,

Thank you for answering my recent forum post re: the variable required to use the supertrend function. Unfortunately, not really having a programming background, I didn't even understand your answer. And now I am running into the same problem with a function for donchian channels. I want to use this function and I know what to enter for the inputs, however it seems to want me to enter something for the variables. Would you be able to tell me what I need to enter to use this function properly? Thanks and sorry to bother you. I'm not sure who else to ask.

Code is:


inputs:
period (NumericSimple),
myMid (NumericRef),
myUpper (NumericRef),
myLower (NumericRef),
upperPrice (NumericSeries),
lowerPrice (NumericSeries);


myUpper = Highest(upperPrice, period);
myLower = Lowest(lowerPrice, period);
myMid = (myUpper + myLower) / 2;


David


Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Vancouver BC Canada
 
Futures Experience: Intermediate
Platform: TradeStation
Favorite Futures: ES
 
Posts: 7 since Dec 2014
Thanks: 5 given, 2 received

DUUUUH...my apologies, I was actually looking at the indicator code where myMid, myUpper and myLower were variables. Sorry for the mistake.

Anyway what I meant was, I still don't get what to enter as a value for numericref inputs when using the function to say, plot a custom ShowMe. For example

SuperTrend(20, 2, 2, STrend(NumericRef)???? )

OR

DonchianChannel(20, ? , ? , ?, High , Low)

Reply With Quote
The following user says Thank You to davidcolin for this post:
 
  #7 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,455 since Apr 2013
Thanks: 222 given, 830 received

David,

you have to create variables and use these to pick the values up that the function references.

Assuming you have created a variable called "trendDirection" you'd use this in the function header:

 
Code
SuperTrend(20, 2, 2, trendDirection ) ;
Now the variable trendDirection can be used to plot the value that the SuperTrend function references via its STrend input.

It will be similar for the DonchianChannel function, but you'll need three variables here.

Regards,

ABCTG

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

Reply



futures io > > > > > Help with SuperTrend input

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

FuturesTrader71: TBA

Elite only

Al Brooks: TBA

Elite only

Jigsaw Trading: TBA

Oct 19

RandBots: TBA

Oct 24
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Input parameter display based on another input parameter Xav1029 NinjaTrader Programming 1 December 28th, 2012 08:36 AM
Multi input indicators Mehul NinjaTrader 1 June 21st, 2012 04:47 PM
trendline with input degrees gparkis MultiCharts 7 December 29th, 2011 12:08 AM
Input's while in running an EA pmm2 MetaQuotes MetaTrader MQL Programming 1 March 13th, 2011 04:11 PM
User input box UManiac NinjaTrader Programming 5 September 21st, 2010 07:57 PM


All times are GMT -4. The time now is 12:16 AM.

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-09-22 in 0.12 seconds with 19 queries on phoenix via your IP 23.20.13.165