NexusFi: Find Your Edge


Home Menu

 





Getting performance report of last N trades


Discussion in EasyLanguage Programming

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




 
Search this Thread

Getting performance report of last N trades

  #1 (permalink)
M4STR0
Florence
 
Posts: 27 since Jan 2021
Thanks Given: 23
Thanks Received: 9

Hello, anyone has an idea on how I could code inside a strategy the print of the profit factor or other performance report factor of the last N trades?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Bigger Wins or Fewer Losses?
24 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,664 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,359


M4STR0 View Post
Hello, anyone has an idea on how I could code inside a strategy the print of the profit factor or other performance report factor of the last N trades?

PositionProfit(X) contains the P/L of previous trades. You could use that to collect the profitable trades and the unprofitable trades and calculate the Profit Factor.

But, it only captures the last 10 trades.

You'd have to create an array to store more values than that.

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
Posts: 34 since Mar 2012
Thanks Given: 1
Thanks Received: 21


This is a code fragment that I have tried for a similar purpose.

Begin with Declarations:

 
Code
Arrays:
	TdResult[1000](0);

Vars:
	RatioAvgToSD(0),
	TotTr(0),
	ProfFractNorm(0),
	J1(0);
	
	
Inputs:
	PrintOutput(True),
	N(30);{Number of Trades to Evaluate}

{Then your main strategy code goes here }

If PrintOutput then begin
	
		TotTr = Totaltrades;
	
		If TotTr > TotTr[1] then begin
			ProfFractNorm = PositionProfit(1)/(EntryPrice(1) * BigPointValue);
			For J1 = 2 to N Begin 
				TdResult[J1-1] = TdResult[J1];
			end;
			TdResult[N] = ProfFractNorm;
			Value1 = AverageArray{[N+1]}(TdResult,N);
			Value2 = StandardDevArray{[N+1]}(TdResult,N,1);
			RatioAvgToSD = IFF(Value2 <> 0, Value1/Value2, -1);
		end;
	
		If LastBarOnChart then begin
			Print(GetSymbolName,"  BarInterval = ",BarInterval,"   Number of Trades Charted = ",TotTr:0:0,"  Number of Trades Considered (last N Trades) = ",N:0:0,"  AvgTrade/StdDev (last N Trades) = ",RatioAvgToSD:0:3);
		end;

end;
You should prefer higher ratios of AvgTrade to Standard Dev.

Follow me on Twitter Reply With Quote




Last Updated on July 20, 2023


© 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