Profit Target as Percent Gain - futures io
futures io futures trading



Profit Target as Percent Gain


Discussion in EasyLanguage Programming

Updated by Jeff65
      Top Posters
    1. looks_one ascr with 2 posts (0 thanks)
    2. looks_two kronie with 1 posts (0 thanks)
    3. looks_3 Jeff65 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 7,436 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 4 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Profit Target as Percent Gain

(login for full post details)
  #1 (permalink)
Toronto
 
 
Posts: 3 since Oct 2010
Thanks: 0 given, 0 received

Help would be greatly appreciated.
I'm trying to exit a position at a 15% gain using easyLanguage.
Here's the relevant pieces of the code:

condition3 = Price > (EntryPrice * 1.15);
if condition3 then
Sell("LE 15% Gain") This Bar On Close;

Reply With Quote

Can you help answer these questions
from other members on futures io?
Stacked Imbalances.
Sierra Chart
IB Bracker Order
Platforms and Indicators
Need a near crosses scan help for TOS
ThinkOrSwim
Looking freelancer for MT4 Indicator
Platforms and Indicators
Times and Sales more data to be displayed
TradeStation
 
 
(login for full post details)
  #3 (permalink)
Toronto
 
 
Posts: 3 since Oct 2010
Thanks: 0 given, 0 received


After poking around I found the solution. I'm rolling the account, so I'm using "initialcapital+netprofit" elsewhere in the code. Here's the relevent code:

variables: x(0);
x = initialcapital+netprofit;
setprofittarget (x * 0.15);

Reply With Quote
 
(login for full post details)
  #4 (permalink)
NYC + NY / USA
 
Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Trading: EMD, 6J, ZB
 
kronie's Avatar
 
Posts: 798 since Oct 2009

excellent answer,

I have often wondered how to set a percentage as a target instead of a fixed interval as such

perhaps this can be shown with examples of how to implement it?

thanks

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Gurnee, IL
 
 
Posts: 46 since Apr 2010
Thanks: 17 given, 95 received


kronie View Post
excellent answer,

I have often wondered how to set a percentage as a target instead of a fixed interval as such

perhaps this can be shown with examples of how to implement it?

thanks

I did not really test the following code, but it should put you in the right direction. The code example show two ways of determining a dynamic profit target. The first is based off the current ATR while the second is a percentage gain of current net profit.

 
Code
Input:
    ATRfactor( 2 ),
    ATRLength( 13 ),
    PrcntGain( 15 );
    
Variables:
    ProfitTarget$(0),
    ATR(0),
    MP(0);

ATR = AvgTrueRange( ATRLength );
MP = MarketPosition;

// Enter new trade on golden cross

If ( average(Close, 50) crosses over Average( Close, 200 ) ) Then
    Buy ("Gold Cross") next bar at market
Else If ( average(Close, 50) crosses under Average( Close, 200 ) ) then
    Sell ("Death Cross") next bar at market;
    
If ( MP = 1 ) Then
Begin
    // Set profit based upon Average True Range
    ProfitTarget$ = ATRfactor * ATR * BigPointValue;
    SetProfitTarget( ProfitTarget$ );
End;


If ( MP = 1 ) And ( NetProfit > 0 ) Then
Begin
    // Set profit based upon percent profit
    ProfitTarget$ = ( NetProfit * PrcntGain / 100 );
    SetProfitTarget( ProfitTarget$ );
End;

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Profit Target as Percent Gain


November 17, 2010


Upcoming Webinars and Events
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts