NexusFi: Find Your Edge


Home Menu

 





Coding for a partial profit


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
 arjfca 
Montreal, Canada
 
Experience: Intermediate
Platform: Multicharts
Broker: Interactive Broker
Trading: Forex
Posts: 263 since Sep 2010
Thanks Given: 440
Thanks Received: 91

Hello and Happy New Year to all

- Is it possible to capture the actual profit of a position or I need to calculate it using the actual price and the price of entry?

- Using Multicharts (TradeSation), how can i code for a partial profit stop loss?

I'm in profit and the actual profit is more than my 2X my initial risk . If I want to protect half of my actual profit, how can I code it?

Any input trully appreciated.

Martin


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Renko can be the way.
Commodities
Wall St slides on mounting AI selloff, S&P 500, Dow …
Traders Hideout
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
What we know about Binances $6.3bn hack - BBC News
Cryptocurrency
Bitcoin’s 2022 low, 2025 high and 2026 low so far arou …
Cryptocurrency
 
  #3 (permalink)
Jeff65
Gurnee, IL
 
Posts: 46 since Apr 2010
Thanks Given: 17
Thanks Received: 97


Is this what you had in mind? It will start a trailing stop 30% from your live position equity once 2*Risk in profit is reached. Compiled under TradeStation 9.0

 
Code
Variables:
   ProfitTrigger$(0), // The amount of profit need to trigger trailing stop
   PctTrailing(30),   // Percent to trail
   Risk$(0);          // The risk in dollars for the given trade
   
   // Let Risk = dollars risked on your trade
   // Then set ProfitTarget = 2 * Risk$
   // Then use SetPercentTrailing
   
   SetStopPosition;
   SetPercentTrailing( ProfitTrigger$, PctTrailing ) ;

arjfca View Post
Hello and Happy New Year to all

- Is it possible to capture the actual profit of a position or I need to calculate it using the actual price and the price of entry?

- Using Multicharts (TradeSation), how can i code for a partial profit stop loss?

I'm in profit and the actual profit is more than my 2X my initial risk . If I want to protect half of my actual profit, how can I code it?

Any input trully appreciated.

Martin


Reply With Quote
Thanked by:




Last Updated on January 11, 2011


© 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