NexusFi: Find Your Edge


Home Menu

 





Intraday Profit Loss


Discussion in EasyLanguage Programming

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




 
Search this Thread

Intraday Profit Loss

  #1 (permalink)
no erocla
turin italy
 
Posts: 96 since May 2013
Thanks Given: 43
Thanks Received: 4

Hi guys,

im trying to write a code that simply stop trading if intraday profitloss > x or < y, for backtested and real trading (flag "test").

Code:

 
Code
                            
//// Storing Morning Balance
if Time 0900 AND Test 0 then begin
PL 
0;
balance GetRTAccountEquity(Account);
END;
if 
Time 0900 AND Test 1 then begin
PL 
0;
balance InitialCapital i_ClosedEquity;
end
now variable "balance" is equal to account balance at 9:00 AM

 
Code
                            
//// Calculating P&L
if test 0 then
PL 
BALANCE GetRTAccountEquity(Account);
if 
test 1 then
PL 
BALANCE - (InitialCapital i_ClosedEquity);

//// EXIT
Condition99 PL >   Max_Daily_Porfit OR PL  < - Max_Daily_Loss 
now, PL is equal to variable "Balance" - actual Account Balance


 
Code
                            
if (marketposition =  and condition99 then 
sell 
("sell p&l"1 contract next bar at market;

if (
marketposition = -and condition99 )then 
buytocover 
("cover p&l"1 contract next bar at market
But unfortunatly it doesn t work, any help ?

Thank you for any response

Regards
No Erocla

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
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
22 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


no erocla,

you should print the values of your variables to the output bar to check them and see what values they contain.
This line "PL = BALANCE - GetRTAccountEquity(Account);" actually becomes negative when your equity grows and positive when you lose money.
Depending on your input values for Max_Daily_Porfit and Max_Daily_Loss I'd guess that your condition99 can never become true.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
no erocla
turin italy
 
Posts: 96 since May 2013
Thanks Given: 43
Thanks Received: 4

Thank you like always for the help

 
Code
                            
//// Storing Morning Balance

if Time 0900 then begin
PL 
0;
balance = (InitialCapital i_OpenEquity);
END;
            
//// Calculating P&L
if Time 0900 then
PL 
=(InitialCapital i_OpenEquity) -  BALANCE 
it works now.

No Erocla

Reply With Quote
Thanked by:
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,434 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

You are welcome. I am glad that it works for you.

Regards,
ABCTG

Follow me on Twitter Reply With Quote




Last Updated on November 12, 2014


© 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