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,094 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?
Kalshi Sets $4.13B All-Time Weekly Record as Polymarket …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Iran Peace Expired NO: Ceasefire on Life Support, OPEC a …
Prediction Markets & Event Contracts
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
Iran Airspace Collapses 18 Points to 15.5% While Hormuz …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
16 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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,243 since Dec 2013
Thanks Given: 4,586
Thanks Received: 10,533

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