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;