Offering to help with scripting

B

Bradford

New member
If you are stuck on something, perhaps I can help you figure it out.
I am stuck on a Watchlist Column that is 'looking forward'.
I want to run a scan End of Day and then place some of those tickers into a static watchlist.
The following 3 days i want the column to check for 3 stop-out conditions.
So the column will start with default 0, and end up with a 0, 1, 2, or 3.
Your previous examples were applied to solve almost everything .

But, how do i code the conditions:
def cond1 = is CCI < 0 on Day1 after scanX triggers, on Day2, on Day3
def cond2 =
def cond3 =
 
RobertPayne

RobertPayne

Member
I am stuck on a Watchlist Column that is 'looking forward'.
I want to run a scan End of Day and then place some of those tickers into a static watchlist.
The following 3 days i want the column to check for 3 stop-out conditions.
So the column will start with default 0, and end up with a 0, 1, 2, or 3.
Your previous examples were applied to solve almost everything .

But, how do i code the conditions:
def cond1 = is CCI < 0 on Day1 after scanX triggers, on Day2, on Day3
def cond2 =
def cond3 =
I'm not certain I understand, precisely, what you are going for but this approach may work.

def cond1 = CCI < 0;
def cond2 = cond1[1] and <whatever cond2 is>;
def cond3 = cond2[1] and <whatever cond3 is>;
plot watchlistValue = if cond3 then 3 else if cond2 then 2 else if cond1 then 1 else 0;
 
RobertPayne

RobertPayne

Member
Robert Payne. I need help writing some of the code for one of my systems. In an uptrend, which I can write with several moving averages, I want to look back from the current 5 min. bar to find 2 or more low points that match the low of the current bar but I don't want to look back more than 60 bars. In other words I am trying to get an arrow to pop up on the chart on the current bar if there are 2 previous times before that price has hit the same low point and bounced off support with at least a one bar gap or more between where the lows hit the same price. Of course that would be a buy signal. For a sell signal you would do the reverse by looking for high points in a downtrend. I think if you can write the code for the buy side I can look at your code and figure out how to write the code for the sell side. If you need more information or clarification let me know. Also if you are like me and don't like to type and would rather talk over the phone let me know and I will give you my cell number or if you have TeamViewer I can show you examples of what I am trying to do on my computer screen. Looking forward to hearing from you. Coy Ponish.
You will need to use a fold loop. More information on this function is available here: https://tlc.thinkorswim.com/center/reference/thinkScript/Reserved-Words/fold.html

Here's an example.

Ruby:
input length = 60;
def countHighTouches = fold i = 0 to length with internalSum = 0 do if GetValue(high, i) == high then internalSum + 1 else internalSum;
plot arrowUp = counthightouches == 3;
arrowup.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
arrowup.setdefaultColor(color.magenta);
arrowup.setlineWeight(3);
 
B

Bradford

New member
I'm not certain I understand, precisely, what you are going for but this approach may work.
Let me rephrase the question.
There are 3 different conditions that would give me concern the trade is no longer going my way.
I want each condition to produce a value of 0 or 1.
If none of the conditions are true then the trade is still good.
If 1 of them is true then the trade may be going against me.
If 2 are true then caution.
If 3 then stop out.

Here is where i am stuck.
Day 1 after trigger what is the sum
Day 2 after trigger what is the sum
Day 3 after trigger what is the sum

Example
Day 1 might total 1
Day 2 might return to 0

Example
Day 1 might total 3 - then stop out

Is your solution still accurate?
 
RobertPayne

RobertPayne

Member
Is your solution still accurate?
Try it and see. Experiment yourself. Play around to see what does and doesn't work. I gave you an example the other day of how to combine conditions and determine what the value is (1, 2, or 3). I am not going to do ALL the work for you.
 
C

Coy Ponish

New member
I just learned how to do a screenshot. As they say a picture is worth a thousand words. Maybe from this example someone can figure out how to get an arrow to pop up on the chart the third time a candlestick touches the same price level without the body going through the price level. I don't care if the candlestick wick goes through the price level as long as the body doesn't go through the price level. Ruby, thanks for your input. I went and read the information about the fold loop but it was beyond my understanding. However it looked like it might be the answer but not sure. If no one is able to help me with this maybe someone could tell me the phone number of a progammer I could call and pay to program this for me.

Well shoot (shoot isn't exactly the word I was thinking of). I couldn't paste the screenshot into this spot. I asked the guy at ThinkorSwim if I could paste the screenshot in another website and he said yes. Back to the drawing board.
 
A

ansheth

New member
VIP
Hello,I am looking for some thinkscript help. I'm back testing the Chaikin recommendations, trying to determine whether I renew in December. To accomplish this, I'm having to pull a bunch of historic data from TOS. If I set a value in a Custom field to represent the days offset, is there a way to use that value in the custom values that look for Price, trend, Chaikin MF, RSI etc? Thank you so much.
 
D

dallzy

New member
Hey folks, I have a study and based on that study I would like to autotrade options positions.. yes I know I can blow my whole account if it makes a mistake... but I would start with only 100$ anyone know who can help with the auto trade options code?
 
Thread starter Similar threads Forum Replies Date
J Questions 3
M Questions 0
Camelotnite Questions 2
F Questions 2
B Questions 1

Top