NexusFi: Find Your Edge


Home Menu

 





Simple trailing stop strategy


Discussion in EasyLanguage Programming

Updated
    1. trending_up 8,729 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?
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


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