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: by djvie11 Views / Replies:176 / 2
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
 

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

  #1 (permalink)
Trading Apprentice
Chicago, IL
 
Futures Experience: Advanced
Platform: Tradestation + Multicharts
Favorite Futures: Forex, Futures
 
Posts: 28 since Jul 2013
Thanks: 16 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
 
  #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)
Elite Member
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,261 since Apr 2013
Thanks: 201 given, 713 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)
 

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only

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

April

Process above all else w/Anthony Crudele @ Futures Radio Show

Elite only

Machine Learning - Quantitative Trading w/Martin Froehler @ Quantiacs

Elite only

Market Dynamics w/Peter Davies @ Jigsaw Trading

Elite only

Ask Me Anything w/Patrick Rooney @ Trading Technologies

Apr 18

Ask Me Anything w/FuturesTrader71

Apr 19

Machine Learning w/Kris Longmore

Elite only

Market Analysis w/Dave Forss

Apr 25

Introducing iSystems with Stage 5 Trading

Apr 27
     

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


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

no new posts
Page generated 2017-03-29 in 0.07 seconds with 19 queries on phoenix via your IP 184.73.55.221