♥ 0 |
Hi Pete, Begginer with Thinkcript here. I’m wondering if I am missing something. It seems like there should be a simple Thinkscript function that returns the number of trades executed by given strategy? I’m looking to build quick graphic feedback on effectiveness of strategy by plotting (FloatingPL ) / (Total # of trades executed by strategy), providing average $-per-position feedback for given perameters, for given strategy. I’ve been struggling to impliment a counter based on changes in FPL(), but 1) It occurs to me that there must be a simpler way and 2) Platform does NOT LIKE Incrementing with IF/THEN statements and FPL[1] +1. (Plot dissapears, only likes to count if FPL[1] is in an “else” branch, ect.) Beating my head against the wall with this for several days now. I really appreciate your help.
Marked as spam
|
Private answer
You did not include a section of fully functional code. So I really have nothing to offer you. However I did do a search for the term FloatingPL and found the following posts on this topic: https://www.hahn-tech.com/ans/strategy-trade-metrics-displayed-in-chart-label/ https://www.hahn-tech.com/ans/the-floatingpl-script/ Did you already search the forum for a solution before posting? If so, did you run across these posts and feel they did not explain why you are not having success?
First, be sure to read up on the details for the FPL() function: https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Others/FPL.html Here is the code I used for my test:
I'm really not sure why anyone would try to do this using a custom chart study. The preferred method is to export the trade report into a spreadsheet. From the spreadsheet, you can build formulas to compute any sort of trade metrics you require. So much easier than writing code. Marked as spam
|
Please log in to post questions.