NexusFi: Find Your Edge


Home Menu

 





Getting performance report of last N trades


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
Six Days to Kickoff: World Cup Prediction Markets Hit $1 …
Prediction Markets & Event Contracts
Iran and Israel Stand Down: What $9M in Peace Contracts …
Prediction Markets & Event Contracts
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
World Cup Opens: USA at 45.5% Tonight as Markets Push Ba …
Prediction Markets & Event Contracts
 
  #2 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,738 since Jul 2012
Thanks Given: 1,918
Thanks Received: 7,487


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 X Reply With Quote
Thanked by:
  #3 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
Posts: 37 since Mar 2012
Thanks Given: 2
Thanks Received: 22


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 X Reply With Quote




Last Updated on July 20, 2023


© 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