Entry at every bar, exit ATR trailing - MultiCharts | futures.io
futures.io futures trading


Entry at every bar, exit ATR trailing
Started: by Loop Views / Replies:246 / 3
Last Reply: Attachments:0

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

Entry at every bar, exit ATR trailing

  #1 (permalink)
Elite Member
Sydney
 
Futures Experience: Intermediate
Platform: Multichart
Favorite Futures: Gold
 
Posts: 26 since Aug 2016
Thanks: 22 given, 4 received

Entry at every bar, exit ATR trailing

Hola

does anyone know how to Easy language a research strategy where its entry at every single bar and then followed by a ATR trailing stop? Long only. And short only.

I think code below is a start... But I don't understand what ts is??

Kind regards

Loop



Inputs: Price(Close),atrPeriod(14),atrMult(1.75);

Vars:
atr(0), ts(0), shstp(0), lgstp(0), trend(0), TriggerPrice(0), dir(0);

atr = AvgTrueRange(AtrPeriod);

lgstp = Price - atr * atrMult;
shstp = Price + atr * atrMult;

TriggerPrice = close;

if TriggerPrice >= ts[1] then
trend = 1
else if TriggerPrice < ts[1] then
trend = -1;

if trend > 0 then
if trend[1] < 0 then ts=lgstp[0]
else if lgstp >= ts[1] then ts=lgstp[0]
else ts=ts[1];

if trend < 0 then
if trend[1] > 0 then ts=shstp[0]
else if shstp <= ts[1] then ts=shstp[0]
else ts=ts[1];

if trend[1] < 0 and trend >= 0 then buy next bar at market;
if trend[1] > 0 and trend < 0 then sellshort next bar at market;

Reply With Quote
 
  #2 (permalink)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,186 since Apr 2013
Thanks: 198 given, 679 received

Loop,

what exactly don't you understand regarding "ts"? It's just a variable, that could have (almost) any other name.
From the code it appears to be holding the value of a trailing stop, hence the abbreviation "ts" was probably used for its name.
It will hold either of the two values below, depending on the trend (as computed by the study).
 
Code
lgstp = Price - atr * atrMult;
shstp = Price + atr * atrMult;
When the TriggerPrice variable is less than the previous bars value for ts, then the study will assume that a down trend exists and update the ts variable following this logic:
 
Code
if trend < 0 then
if trend[1] > 0 then ts=shstp[0]
else if shstp <= ts[1] then ts=shstp[0]
else ts=ts[1];
It will be vice versa for an up trend.

Regards,

ABCTG

Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #3 (permalink)
Elite Member
Sydney
 
Futures Experience: Intermediate
Platform: Multichart
Favorite Futures: Gold
 
Posts: 26 since Aug 2016
Thanks: 22 given, 4 received

Entry


Thank you for heads up!!

Any idea how to have an entry at every bar in order to do trend research?

Reply With Quote
 
  #4 (permalink)
 Vendor: abctradinggroup.com 
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,186 since Apr 2013
Thanks: 198 given, 679 received

Loop,

by the way you can show your appreciation for posts on futures.io by clicking the "Thanks" button next to the code.

An entry on every (!) bar will require a bit of work most likely as you have to deal with pyramiding and scaling out of positions. Do you actually want that or do you want to enter only again when flat?
Feel free to post your code attempts and I am sure someone is able to steer you in the right direction.

If you are looking for someone to code it for you, you might be able to find help in the "Want your EasyLanguage Indicator Created free" thread.

Regards,

ABCTG

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

Reply



futures.io > > > > Entry at every bar, exit ATR trailing

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

2016 True Edge Awards: Voting is open until Jan 21!

Now
 

Anthony Drager: Pulling the trigger with confidence

Elite only
 

Leo Murphy: The Art and Science of Technical Analysis

Elite only
 

FuturesTrader71: Ask Me Anything

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Order Entry, Target, Trailing Stop, and Exit DrRon EasyLanguage Programming 18 November 24th, 2015 02:43 PM
Trailing Stop based on ATR rahulgopi TradeStation 3 October 9th, 2014 11:51 PM
Place text at order entry/exit bar ivanyu EasyLanguage Programming 2 August 5th, 2013 07:20 AM
ATR Trailing Stop Parameter Optimization tbmuc Elite Automated Trading 2 November 29th, 2012 04:52 PM
a simple entry exit bar johni EasyLanguage Programming 7 July 23rd, 2011 05:34 AM


All times are GMT -4. The time now is 09:44 PM.

no new posts
Page generated 2017-01-21 in 0.10 seconds with 19 queries on phoenix via your IP 54.211.249.219