Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar! - EasyLanguage Programming | futures.io
futures.io futures trading


Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar!
Started:September 28th, 2016 (08:00 PM) by djvie11 Views / Replies:126 / 2
Last Reply:September 29th, 2016 (04:51 AM) 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
 

Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar!

Old   #1 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 27 since Jul 2013
Thanks: 14 given, 1 received

Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar!

Hi Guys

So I've been going back and forth trying to get this to work. I would love to use the PercentTrailing code with my strategy but I don't want for the order to be submitted intrabar (too many fluctuations). I would like to assess the max run-up of the position and calculate how much that max run-up has come down @ the close of the bar (not intrabar).

I tried to code this multiple ways into my strategy, but everything I've tried works nothing close to adding a "PercentTrailing" to my strategy. My attempts are below. Any suggestions would be greatly appreciated!

1) make it a condition, and when said condition triggers it would exit the position

 
Code
Inputs:
DollarAmt (1),
PctTrail (.25);

Condition5 = C <  (OpenpositionProfit + DollarAmt) - (MaxpositionProfit * PctTrail) ) ;
2) Then I tried putting this at the end of my code to exit as well:
 
Code
Inputs:
DollarAmt (1),
PctTrail (.25);

IF
(OpenPositionProfit + DollarAmt) < MaxPositionProfit - (MaxPositionProfit * PctTrail) 
THEN 
SetExitOnClose  ;
Again, non of these "solutions" worked like the true SetPercentTrailing code. Any ideas of how to work this on the close of the bar?

Thanks!
Brandon

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

 
Old   #3 (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,176 since Apr 2013
Thanks: 197 given, 677 received


djvie11,

when the condition for your stop is met you can send an order to close the open position, for example
 
Code
Sell ( "LX" ) next bar market ;
This would issue the order at the end of the bar and you'd get executed around the open of the next bar. Which is to be expected when you send an order at the close.

You could fool your software (and yourself as you will create results that you can't reproduce live) by using "this bar Close" for the order, but this will likely not be the fills you get live.
You could look into custom sessions that would allow you to walk around that problem or to use intrabar order generation, which would give you the ability to close out the position near the actual bar close.

Regards,

ABCTG

Reply With Quote

Reply



futures.io > > > > > Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar!

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
 

Bookmap New Indicator Panel, Cumulative Delta, Order Flow demo

Jan 17

An Afternoon with FIO member Massive I

Elite only

Leo Murphy: Making sense of Technical Analysis and Random Walk

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
fibonacci templates doesn't works alextrd NinjaTrader 4 April 15th, 2015 05:24 PM
Trail Stop Indicator Michael Krall NinjaTrader Programming 2 March 26th, 2014 10:30 AM
Trail Stop Kush NinjaTrader Programming 4 June 14th, 2012 01:01 PM
Execute trade intrabar on bar close indicator spinnybobo NinjaTrader 3 April 2nd, 2012 03:59 PM
Audit Trail of Trades ab456 Traders Hideout 1 November 28th, 2011 03:41 PM


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

no new posts
Page generated 2017-01-16 in 0.08 seconds with 19 queries on phoenix via your IP 54.147.253.45