NetProfit - futures io
futures io



NetProfit


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,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
 

NetProfit

(login for full post details)
  #1 (permalink)
AhmedF
north bergen
 
 
Posts: 13 since Feb 2017
Thanks: 3 given, 1 received

Does anyone know how to write a code in esaylanguage that stops a robot from trading after it has profited x amount of pips?

Reply With Quote

Can you help answer these questions
from other members on futures io?
Experience with AGN (Introducing Broker)
Brokers
For the experts of Metastock
Platforms and Indicators
TD Sequential for NT or MW?
Platforms and Indicators
Eurex Denali vs dxFeed
Sierra Chart
Is there inherently more opportunity in smaller markets?
Traders Hideout
 
 
(login for full post details)
  #3 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,264 since Apr 2013
Thanks: 417 given, 1,509 received


AhmedF,

there are several way to approach this, one would be to store the net profit in a variable at the beginning of a new period in which you want to stop the trading when a certain net profit is reached (for example daily or weekly, but others would be possible, too).

Now you compute the difference of the current net profit to the value that you stored within the variable. If the difference is greater than your profit limit, block your code from taking further entries and maybe even close all open positions.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #4 (permalink)
AhmedF
north bergen
 
 
Posts: 13 since Feb 2017
Thanks: 3 given, 1 received

vNetProfit(0),
vDailyNetProfit(0),

If Date = CurrentDate and Date <> Date[1] then
begin
vNetProfit = NetProfit;
end
else
If Date = CurrentDate then
begin
{ Calculate Daily NetProfits }
vDailyNetProfit = NetProfit - vNetProfit;
end;

i found this online how do implement this with order execution so once the robot profits x amount ( E.g. 200$) stop trading. At the same time i want it to run between certain hours 8am-10:30am the way i want it to function is the following . if 200$ are made starting at 8am and 1030 has not come yet then stop trading else continue trading until 1030 then stop disregarding if it made 200 or not.

ABCTG View Post
AhmedF,

there are several way to approach this, one would be to store the net profit in a variable at the beginning of a new period in which you want to stop the trading when a certain net profit is reached (for example daily or weekly, but others would be possible, too).

Now you compute the difference of the current net profit to the value that you stored within the variable. If the difference is greater than your profit limit, block your code from taking further entries and maybe even close all open positions.

Regards,

ABCTG


Reply With Quote
 
(login for full post details)
  #5 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,264 since Apr 2013
Thanks: 417 given, 1,509 received

AhmedF,

I am afraid without knowing how your "order execution" part of the code looks like, it's hard to give you a clear direction on how to add the code snippet you posted.

The variable vDailyNetProfit holds the daily profit since midnight, if you only want it to hold the profit since 8am, you would have to modify the code to do the reset based on time and not on the date change.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #6 (permalink)
AhmedF
north bergen
 
 
Posts: 13 since Feb 2017
Thanks: 3 given, 1 received

if (data2var2 > 0 )
then begin
vvsup = true;
VVSDN = False;
end;
if (data2var2 < 0 )
then begin
vvsup = False;
VVSDN = True;
end;

if VVSUP then begin
if ( var3 crosses above -0.88) and (trnd > 0) then buy next bar at market;

if VVSDN Then begin
if ( var3 crosses under 0.88) and (trnd < 0) then sellshort next bar at market;

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,264 since Apr 2013
Thanks: 417 given, 1,509 received

AhmedF,

for that code you could for example set VVSUP and VVSDN to false when your profit goals are met. Additionally you can exclude this part from being executed when your goals are met:
 
Code
if profitGoalIsMet = false then
begin
if (data2var2 > 0 )
then begin
vvsup = true;
VVSDN = False;
end;
if (data2var2 < 0 )
then begin
vvsup = False;
VVSDN = True;
end;
end
else
begin
vvsup = False;
VVSDN = false;
end;
Something like the above should work, under the condition that profitGoalIsMet is a boolean variable that holds the result of your profit goal check.

Regards,

ABCTG

Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > NetProfit


Last Updated on February 23, 2017


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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