NexusFi: Find Your Edge


Home Menu

 





Easy Language SetPercentTrailing function


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one SMCJB with 1 posts (0 thanks)
    2. looks_two futuresgwb with 1 posts (0 thanks)
    3. looks_3 ABCTG with 1 posts (2 thanks)
    4. looks_4 FuturesTrading with 1 posts (0 thanks)
    1. trending_up 2,517 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

Easy Language SetPercentTrailing function

  #1 (permalink)
FuturesTrading
San Diego USA
 
Posts: 1 since Feb 2016
Thanks Given: 0
Thanks Received: 0

Working on a strategy on a 30min time frame trading the NQ emini.

Entering position as a market order

After entry I am using SetPercentTrailing TS function to preserve 15% of the profits.

Issue I'm having is it looks great when back testing. 85% of the orders are closed by the SetPercentTrailing function. However, when testing with live capital the SetPercentTrailing function seems to close the position early.

For instance today I used it on the NQ. Entered short at 4111. Covered at 4108 using the SetPercentTrailing function. However, when I turned automation off and then turned it back on, it said it entered at 4114 and covered at 4078.

So my question is why are back testing results showing more of a profit then live? I assume it has something to do with the SetPercentTrailing function. I understand why it shows a different entry price due to slippage. However, I can't confidently say 30 point difference on the cover was due to slippage. Therefore, I have to assume it's something with the SetPercentTrailing function.

Any thoughts or suggestions on this?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
About a successful futures trader who didnt know anythin …
Psychology and Money Management
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

FuturesTrading,

the problem might be found in how you do your backtests and how the system is coded. For example when you use the build in exit functionality like targets or trailing stops you should always use the look inside bar backtesting with the highest resolution possible. Otherwise the platform can't detect how a bar evolved from open to close and make assumptions that not necessarily reflect the situation that was present realtime.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
futuresgwb
Baltimore Maryland USA
 
Posts: 2 since Jan 2019
Thanks Given: 0
Thanks Received: 0


I have had the same problem. In backtesting "SetPercentTrailing" exits at the close of the next bar. I turned on interbar generation ([intrabarordergeneration =true]), but "SetPercentTrailing" won't execute in that environment. My solution is to write my own code for a custom built "SetPercentTrailing" instead of using EL. It will be worth a try.

Reply With Quote
  #4 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,207

As @ABCTG said you need to enable "LIBB" or "look inside bar backtesting" otherwise the platform can't detect how a bar evolved from open to close and make assumptions that not necessarily reflect the situation that was present realtime.

Also a word of warning. Be very careful with percentage, multiplication and division of prices on continuous contracts. Every time there is a contract roll, the history changes, and hence your 'percentage, multiplication or division' changes as well. This may not be pronounced with equity index contracts but in some of the energy and metal contracts the effect can be significant.

Reply With Quote




Last Updated on June 7, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts