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


Coding a PercentTrail that works like %Trail, but doesn't execute Intrabar!
Updated: Views / Replies:253 / 2
Created: by djvie11 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: 34 since Jul 2013
Thanks: 21 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)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,329 since Apr 2013
Thanks: 212 given, 755 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)

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

May

An overview of volumetric analytical tools w/Sergey Sokolov @ PTMC

Elite only

John Hoagland (TBA)

Elite only

FuturesTrader71 Extended Ask Me Anything (AMA)

Elite only

Pete @ Jigsaw Trading (TBA)

Elite only

John @ No BS Day Trading (TBA)

Elite only

An Afternoon with FIO member Softsoap (being rescheduled)

Elite only
     

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 11:15 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-05-28 in 0.08 seconds with 19 queries on phoenix via your IP 54.162.184.185