Tracking or Referencing A Weighted Averaged Position


Category:
0
0

Hello,

Say I have multiple purchases of a stock over the day, at different prices and volumes. Can thinkscript strategies reference my weighted average position, as part of how it makes decisions for future entries/exits? (for example – averaging down)

Thanks!

Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on July 18, 2020 9:54 pm
62 views
0
Private answer

In Thinkorswim, chart strategies are for back testing purposes only. They cannot execute live orders. So trying to incorporate live trade positions with theoretical orders plotted on the chart is a dead end. Mixing reality with fantasy, I see no value in that even if it were possible.

Now if you were working on a platform that performed fully automated trading I can see how this might have a useful result.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on July 19, 2020 8:52 am
0
My question was not written clearly. I meant that a TOS strategy (backtesting) has had multiple entry points on a stock, due to whatever conditions are required to trigger the buying. Can a strategy like this review its own weighted average position over the given period as part of how it makes further triggers to buy (or sell)? As a simple theoretical example - a strategy triggers a buy when the last price hits a certain EMA. This strategy could have multiple entry points over time before a sell trigger, depending on what you make it. Can a sell trigger be scripted which would refer to the average price held at any given time - say 'sell when the average price exceeds 2% of the last price'? So the script bought a share at $2, then it bought again at $1.90, then it bought again at $1.80. The average price at this point is $1.90. Can the script keep track of a weighted average position over time like this as part of its strategy
( at July 19, 2020 4:46 pm)
0
It may be possible. I have not had anyone request this before so I have not tried to seek a solution. The research alone would take well over an hour. I have 15 min to provide individual solutions in the Q&A forum. So this is not something I can address here. If it is possible, I think you asking a awful lot from the very simplistic scripting language used in Thinkorswim. Great idea, but it's foolish to try to make it to Mars using a hang glider.
( at July 19, 2020 5:57 pm)
0
is there an alternative software you recommend for more advanced things like this?
( at July 19, 2020 8:08 pm)
0
I have never attempted to include this type of functionality in a chart strategy. So I have nothing more to recommend. I would have to spend a considerable amount of time researching and testing before I could determine if this could be accomplished in TradeStation. Far beyond the scope of any solution I can provide in the Q&A forum.
( at July 20, 2020 10:15 am)