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 4,025 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #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?
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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 X 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 Stellar & Tradestation
Broker: Primarily Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals, U308 and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,241 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,531

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


© 2026 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 - Downloads - Top
no new posts