The Conditional Order needs to be set up manually, each time you want to make a trade. The ToS platform does not support autotrading.
To use the Twin Range Filter in an OCO, find and change these two lines in the script:
https://usethinkscript.com/threads/twin-range-filter-for-thinkorswim.12831/#post-115977
Ruby:
def long = longCond and CondIni[1] == -1;
def short = shortCond and CondIni[1] == 1;
to these two lines:
Ruby:
plot long = longCond and CondIni[1] == -1;
plot short = shortCond and CondIni[1] == 1;
The manual setup for conditional orders is identical to the manual setup for the scan hacker and for chart alerts.
Which works out perfectly because this means we can use the scanner and chart alerts to test that your conditional order will do what you want it to do.
To Test and Setup Conditional Orders
1. First put your signals in the scan hacker. This is to verify that you have correctly defined the conditions you want to make entry on and that it runs without errors and finds signals. Need help setting up the scanner? Here is a tutorial:
https://usethinkscript.com/threads/how-to-use-thinkorswim-stock-hacker-scans.284/
2. Everything worked well with the scanned signals? Now right-click on any chart. Then click on chart alert. You have now opened the Condition Wizard for the chart alert. Fill it in the same way as the scan hacker. Verify that your filter runs without errors and generates an alert. This has the added benefit that. You can save this alert! Awesome! Because unfortunately, conditional orders are once and done, and they are not saved. It is a PITA to have to manually enter them each time. However, conditional orders can call your saved chart alerts, so you don't have to keep re-typing it.. So cool!
3. If the chart alert fired in the manner that you want, you can now create your
conditional order.
It should be noted that the ToS condition wizard has limited capabilities. It only likes simple scripts. Many scripts time out and / or are too complex, or cannot be used. This is why doing the testing as outlined above is so important.