Repaints Problem Scans, Watchlists, Chart Alerts, Conditional Orders With Repainting Scripts in ThinkOrSwim

Repaints

kabira

Member
VIP
Thanks @MerryDay let me go through it and get back to you. Appreciate your help.
This is the code and screenshots I am trying to use. Instead of referencing the whole AGAIG study in the conditional order and making it true I have modified and got the code ONLY what I need for short right now. I am just trying to get my short conditional order triggered before I move on to OCO. This is a single conditional order for [short] now.

I talked to TD and they said if I have to copy paste the code then it cannot be more than 200 characters. Since AGAIG was more than 200 characters This is what I got trying to get it under 200 characters. This code gives me the right signals on the order rules screen but it does not trigger when the condition is met. Please advise what I am doing wrong.

With the code below I was expecting it to trigger it at the close of the candle where the short bubble shows up. Please advise.

def h=ExpAverage(high,5);
def k=ExpAverage(low,5);
def E=ZigZagHighLow(h,k,.01,.05,5,2.0).lastH;
plot s= !IsNaN(E);


B0x52uw.png



RKDjNPa.png



5ZDUWHP.png
 
Solution
This is the code and screenshots I am trying to use. Instead of referencing the whole AGAIG study in the conditional order and making it true I have modified and got the code ONLY what I need for short right now. I am just trying to get my short conditional order triggered before I move on to OCO. This is a single conditional order for [short] now.

I talked to TD and they said if I have to copy paste the code then it cannot be more than 200 characters. Since AGAIG was more than 200 characters This is what I got trying to get it under 200 characters. This code gives me the right signals on the order rules screen but it does not trigger when the condition is met. Please advise what I am doing wrong.

With the code below I was...
This is the code and screenshots I am trying to use. Instead of referencing the whole AGAIG study in the conditional order and making it true I have modified and got the code ONLY what I need for short right now. I am just trying to get my short conditional order triggered before I move on to OCO. This is a single conditional order for [short] now.

I talked to TD and they said if I have to copy paste the code then it cannot be more than 200 characters. Since AGAIG was more than 200 characters This is what I got trying to get it under 200 characters. This code gives me the right signals on the order rules screen but it does not trigger when the condition is met. Please advise what I am doing wrong.

With the code below I was expecting it to trigger it at the close of the candle where the short bubble shows up. Please advise.

def h=ExpAverage(high,5);
def k=ExpAverage(low,5);
def E=ZigZagHighLow(h,k,.01,.05,5,2.0).lastH;
plot s= !IsNaN(E);

1. TD Support is correct:
The Condition Wizard for Scans, Chart Alerts, Conditional Orders is limited to 200 characters.
The workaround is simple. You save the script as a study and then reference the study in your Scans, Chart Alerts, Conditional Orders.
Tutorial: https://usethinkscript.com/threads/how-to-use-thinkorswim-stock-hacker-scans.284/
There is a catch. Your script must be "cleaned". Scans, Watchlists, Chart Alerts, Conditional Orders do not perform well with extraneous statements which are not related to the logic needed for the scan /watchlist /order. Most studies are formatted to be used on charts. To optimize an existing script for use in conditional orders, scans, and chart alerts, all formatting statements need to be removed, along with any other coding not directly related to creating the signal.

2. It is not recommended to create Scans, Watchlists, Chart Alerts, Conditional Orders on repainting scripts (ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows) such as yours.
The reasons are:
a. The script will fire on a false signal. The signal will then disappear. As no short bubble appears on your chart, you will think the order is broken.
b. The script will not fire on a repainted short bubble because it wasn't on the current bar at the time. It was painted on afterwards. You will later see a short bubble on your chart that did not fire, you think the script is broken.

3. Workaround For Creating Scans, Watchlists, Chart Alerts, Conditional Orders For ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows (not recommended).
You can try adding within x bars to the Scans, Watchlists, Chart Alerts, Conditional Orders For ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows. This tells your script to go back in time to look for the repainted signals. Your order execution lag will be equal to your x variable. If you tell it to find all signals that were repainted onto the last 3 bars. Your max lag will be 3 bars. It will not find signals that were repainted more than 3 bars ago.​
Ruby:
def h=ExpAverage(high,5);
def k=ExpAverage(low,5);
def E=ZigZagHighLow(h,k,.01,.05,5,2.0).lastH;
plot s= !IsNaN(E) within 3 bars;
 
Last edited:
Solution
1. TD Support is correct:
The Condition Wizard for Scans, Chart Alerts, Conditional Orders is limited to 200 characters.
The workaround is simple. You save the script as a study and then reference the study in your Scans, Chart Alerts, Conditional Orders.
Tutorial: https://usethinkscript.com/threads/how-to-use-thinkorswim-stock-hacker-scans.284/
There is a catch. Your script must be "cleaned". Scans, Watchlists, Chart Alerts, Conditional Orders do not perform well with extraneous statements which are not related to the logic needed for the scan /watchlist /order. Most studies are formatted to be used on charts. To optimize an existing script for use in conditional orders, scans, and chart alerts, all formatting statements need to be removed, along with any other coding not directly related to creating the signal.

2. It is not recommended to create Scans, Watchlists, Chart Alerts, Conditional Orders on repainting scripts (ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows) such as yours.
The reasons are:
a. The script will fire on a false signal. The signal will then disappear. As no short bubble appears on your chart, you will think the order is broken.
b. The script will not fire on a repainted short bubble because it wasn't on the current bar at the time. It was painted on afterwards. You will later see a short bubble on your chart that did not fire, you think the script is broken.

3. Workaround For Creating Scans, Watchlists, Chart Alerts, Conditional Orders For ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows (not recommended).
You can try adding within x bars to the Scans, Watchlists, Chart Alerts, Conditional Orders For ZigZags, Swings, Waves, Reversals, Pivots, and all Higher Highs-Lower Lows. This tells your script to go back in time to look for the repainted signals. Your order execution lag will be equal to your x variable. If you tell it to find all signals that were repainted onto the last 3 bars. Your max lag will be 3 bars. It will not find signals that were repainted more than 3 bars ago.​
Ruby:
def h=ExpAverage(high,5);
def k=ExpAverage(low,5);
def E=ZigZagHighLow(h,k,.01,.05,5,2.0).lastH;
plot s= !IsNaN(E) within 3 bars;
Thank you so much @MerryDay. It is working now with your change. It getting triggered when I add the code with x bars. I can play from here. At least its getting triggered. This was a single condition order for short. I am in the process of creating an OCO order with this condition. Will keep you posted how it goes. Thanks so much again.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
288 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top