Conditional order based on Volume Profile POC


Category:
0
0

Hello. I’ve watched some of Pete’s videos on YouTube but I just learned about this forum. I am hoping there’s some way to create a conditional order in TOS based on consecutive study criteria rather than on the “All” or “Any” condition criteria that I see in the Condition Wizard. I have created 6 additional lines in the Volume Profile study… 3 of them are above the point of control (POC) and 3 are below it at different distances (I’ve attached a picture). Once price has hit either the 3 lines above or the 3 lines below in consecutive order I want to buy a call or put, respectively. Since all 3 lines can be hit within 1 bar, I can’t base the order on consecutive bar activity. Does anyone know if there’s a way to do this?

Attachments:
Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on January 16, 2023 9:27 am
188 views
0
Private answer

The good news is you no long have to spend anymore time searching for a solution to this. The bad news is that it is completely impossible. It's so far away from being possible that there are no workarounds or compromises to suggest.

  • From your description, your code will need to keep track of a moving target. And then keep track of how many times it has hit that moving target (POC). This requires the use of recursive variables and those are not supported for the Conditional Order or Study Alert tools.
  • Even without your screenshot being complete, I can see signs that you are using a setting for the VolumeProfile study which is incompatible with being used as a Study Alert, Conditional Order, Custom Scan or Custom Watchlist column.
    • Which setting is that? "time per profile". If it is set to "CHART", you can't replicate that in any other tool on Thinkorswim except for a chart.
    • So to clarify, the VolumeProfile settings must set to a specific "time per profile" other than "CHART" and the "on expansion" setting must be set to "No" (as it is in your screenshot).

In order to help you avoid spending time on impossible solutions in the future I will give you a basic rule of thumb. If your source code includes more than 2 dozen lines, don't even bother trying. These tools are meant for only the most basic scripts. And if you look at the source code of the VolumeProfile indicator included with Thinkorswim, you will see it contains several dozen lines of code.

The other detail that may help you avoid these time sinks in the future is to learn how to identify recursive processes. Which lead to the need for recursive variables. What is recursion? It is when the value of a variable on the current bar is completely dependent on it's own value from a previous bar. So the simple task of keeping track of whether a value has been crossed in the past, requires recursive variables. Trying to keep track of several lines being crossed in the past, takes several recursive variables. Trying to keep track of which order each of those several lines have been crossed is also going to require recursion. And also requires a degree of complexity which is far beyond the scope of solutions we provide free of charge in this forum.

When posting to this forum in the future, please keep the following important details in mind. Due to these missing details, no one would be able to attempt a solution to your request, even if one were possible.

  1. Your screenshot is insufficient in that it does not show which settings have been applied to the Volume Profile study itself. And those settings are crucial. Nor can we see the ticker symbol or time frame applied to the chart.
  2. You did not include working source code to replicate what is shown on your screenshot. And without working code, no body is able to take the first step in attempting a solution.

I hope that helps. Much of my response was also intended to instruct the rest of our viewers to help them avoid spending time on projects that are far too complex for the Conditional Order tool.

Marked as spam
Posted by (Questions: 37, Answers: 4097)
Answered on January 16, 2023 10:14 am