NexusFi: Find Your Edge


Home Menu

 





Simple trailing stop strategy


Discussion in EasyLanguage Programming

Updated
    1. trending_up 8,719 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Simple trailing stop strategy

  #1 (permalink)
jeemba
Tampa Florida
 
Posts: 1 since Jul 2013
Thanks Given: 0
Thanks Received: 0

I am new to the tradestation platform and learning EasyLanguage.

I am trying to do a simple strategy where on Each day a new high is made, old Sell Stop order is canceled and new Sell stop order with Stop Price at 2% below high is entered.

I do not know why this code does not work.

Inputs: Percentage(2);

//Entry
If Date = 1110316 then
Buy( "Buy" ) next bar at market ;

//Exit
If MarketPosition = 1 then begin
If High[0] > highest(high,BarsSinceEntry) then begin
Setstopposition;
Setpercenttrailing(High - EntryPrice,Percentage(2));
end;
end;


I am using the SPY symbol form 2011-01-01 to 2011-06-30 . My trade is supposed to open on 2011-03-17 and closes on 2011-04-12.

Thanks in advance for any assistance.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Deepmoney LLM
Elite Quantitative GenAI/LLM
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


Hi jeemba,
I am afraid, but the reserved word Setpercenttrailing doesn't work like that. You would need to do something like this:

 
Code
//Exit
If MarketPosition = 1 then begin
If High[0] > highest(high,BarsSinceEntry) then 
 MyStopPrice = High - High * .02;

Sell ("SX") next bar MyStopPrice stop;
end;
You should give MyStopPrice a value when you open the trade, too.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on August 2, 2013


© 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