♥ 0 |
I’m using that feature “FloatingPL” on the thinkorswim platform, # plot FPL = FPL(); FPL.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM); And then I had this idea of plotting another histogram similar to the “FloatingPL” but based on some risk parameters, That will help in decision-making during the day I mean, it probably will not be anything too complicated because the calculation involved in the process is quite simple FPL = (current price) – (entry price) Anyways, just throwing this topic in the air, case anyone have knowledge in this area that could share with us and Thank you Pete for continuing to supply this community with plenty of thinkorswim information
Marked as spam
|
Private answer
Here is the answer I had, from the team of ThinkScript Unfortunately, the base code for FloatingPL is hard-coded into the platform and the code is not available. The FloatingPL study uses the FPL() function, which is what is hard-coded and not written in thinkScript. For more information about FPL, please see this link: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/FPL.html Best Regards, Trade Desk/thinkScript Marked as spam
|
|||||||
Private answer
It’s not true that entry price cannot be used to customize your PnL; I spent an entire weekend actually creating my own, most of the time, if not all, was focused on figuring this out. The reason I wanted to make my own is because using PnL to determine which stocks preforms well with a certain strategy is almost in terms of dollar value.What matters is your total percentage returns on the strategy. For instance, if I made $5 or 50% on $10, and $5 on $1MM or essentially zero, the charts data would read the same. How to get around this: within your strategy, set you chart to price type Last, go to the last line of code and do something like: “plot FPL= (entryprice()-close)/close”. You can customize as you wish but that is the general idea. Marked as spam
|
|||||||
Private answer
As of the time of this post there is nothing in the Thinkscript language reference that makes this possible. The nearest element they give us is a function called EntryPrice(). Details here: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/EntryPrice.html A quick test reveals that this function is only valid when used within a strategy and not within a study. Create a study with these two lines of code:
Even if there is a strategy present on the chart the output of this remains N/A for it’s entire span. So it cannot be used to create custom P/L graph. In order to do anything meaningful at all they would need correct for this. They meaning the Thinkorswim developers. They would also need to create several other functions to read other elements from the active strategy in the chart and enable it to be plotted in a lower subgraph. In this article I detailed some of these challenges: https://www.hahn-tech.com/thinkorswim-strategies-complex-stop-management/ The only other alternative is to abandon the entire concept of using a strategy to plot theoretical buy and sell orders. In it’s place you would write your own framework to mimic the work done by the strategy engine. It is only within this framework that you could control all the elements needed to keep track of each theoretical entry/exit/price/trade size. And from that, you could create whatever sort of P/L calculations you want. This is a BIG project. One that would cost a lot of money. Given there are other platforms out there that can already handle this I’m not sure it’s worth the expense. Marked as spam
|
Please log in to post questions.
Basically we are going to need a comparison algorithm
Which will compare the floating price of the stock with your point of entry on the trade (in which the conditions to buy or short were respected)
Move to another platform. The advanced techniques you are trying to employ are simply not supported on Thinkorswim. OR, work within the limitations that are present and accept the fact there are many elements you simply cannot measure.