SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Jan 29, 2020 7:06 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri Jan 07, 2011 2:24 am 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Hi All,

What would be the most efficient way to measure the P/L from the most previous round trade.
Is there a simple method which could be used with an if than such as:

if (last.Trade (return > .01))
{}

What I want to do is have the program self monitor it's environment in part by counting the reletative profits vs losses of recent.

Thank you.


Top
 Profile  
 
PostPosted: Wed Jan 12, 2011 1:54 am 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
With no replies, I take that a method is not the best way to accomplish what I'm after?


Top
 Profile  
 
PostPosted: Wed Jan 12, 2011 2:04 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Hi,

we've just back to office after New Year holidays. Will try to reply tomorrow.

Regards,
Anton


Top
 Profile  
 
PostPosted: Wed Jan 12, 2011 7:48 am 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Dr Fokin,

Thank you for your reply. My particular intent for writing a second post was to consider if my question was enormously off base or perhaps looking in the wrong rabbit hole for the problem I'm trying to solve. I hope your time away was of great encouragement, and I will be thankful for your further assistance.

Best,
Red


Top
 Profile  
 
PostPosted: Wed Jan 12, 2011 12:56 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

I think Portfolio.Transactions[Portfolio.Transactions.Count - 1].PnL is what you are looking for. Is it?

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Wed Jan 26, 2011 6:04 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Sergey,

This was in fact what I was hoping to find. I tried to transpose your code line in order to call the entry price of the most recently transaction using the entry price property, or the average entry price:

double entryPrice = Portfolio.EntryPrice[Portfolio.EntryPrice.Count - 1];

OQ error message said that there is no extenion method "EntryPrice" to accept the first argument.

My question, how should I properly code this in order to receive the price of the most recent position entry / order fill so that I can include this for the calculation of a stopLoss price to be entered on a second order.

Thanks,
Red


Top
 Profile  
 
PostPosted: Thu Jan 27, 2011 2:04 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

The correct line is:
strategy.Portfolio.Transactions[Portfolio.Transactions.Count - 1].Price

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Thu Jan 27, 2011 7:20 pm 
Offline

Joined: Mon Dec 06, 2010 2:15 am
Posts: 47
Thank you. I had tried this, but for some reason I had an error, but now that I know this is the correct code I'll trouble shoot.

Thanks,
Red


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group