Conditions wizard Question

tradebook

New member
Hi Folks, I am not familiar with the language, but can someone help me with this. Testing out a few strategies here.

For example. How can I say in "code language" If price reaches X line on a study then B will happen.

In the conditions wizard my choices for price are optioned for ask, bid, close, low etc.

Which one is when price touches or reaches an area.... let's say a moving average or a fib line then do this.

Let me know if I need to clarify further.
 

rad14733

Moderator
Staff member
VIP
@tradebook When coding if...then...else clauses, close is the same as last until the candle/bar closes... How you act on a condition depends on what you are doing... Perhaps perusing some of the plethora of scripts here in these forums as well as the standard Studies in TOS would be beneficial... Also spend ample time in the Thinkscript Learning Center as it won't be time wasted and you're sure to learn more than you expect to...

Here are a couple common conditions...

Ruby:
close crosses above ExpAverage(close, 9)

# OR #

def isUp = if ExpAverage(close, 9) is greater than ExpAverage(close, 9) then 1 else Double.NaN;

# And on and on and on #
 

MerryDay

Moderator
Staff member
VIP
Here is an example of where HLC3 crosses EMA9. Does that help at all? This uses all TOS defined functions. If you wanted to cross a fib line, you need to load a custom study into your app. You would first have to search through the 450 results for Fibonacci on this forum find which one suits you best. Copy&Paste the code and then it will appear in your Condition Wizard. Clear as mud? There are many many youtube tutorials on this subject or keep asking questions. We will keep the light on. :)
gLGRtmP.png
 

tradebook

New member
Thank you both. Hi MerryDay, the pic you pasted is the area i am in. I have a general fib code. I am at step one at the moment. I am trying to understand was which one to choose where you selected HLC3. meaning, how do you define when prices touches and moves above a line, then X. What selection is that in the edit condition selection? Would that be HLC3?
 

MerryDay

Moderator
Staff member
VIP
@tradebook if you fill out your profile it will tell us your background and what your level of experience, we won't feel like we are talking down to you and/or over your head.
K2ZXyY7.png

In these volatile times, candles can span a significant price range.
Choosing what part of the candle you want to have touch and move above the line will have an effect on your strategy.
HLC3 is just an example it is an average of the high/low/close of the candle.

Again, if you fill in your profile as to if you are a scalper/swing trader, etc..., it would be easier to talk what works better.
For example, I am a swing trader. It is more standard to use a short moving average crossing a longer moving average or a short moving average crossing a fib line as it eliminates outliers thus reducing false signals. You can see the syntax for exponential moving average in sample image I provided. You see the box for length. A short length can be anything. Common is 3, 5, 9.
None of this applies to scalpers, who want to get in and out fast so they play the outliers.

The action you can choose from the middle column of the condition wizard. We use 'crosses' to specify touches the line. Your choices are crosses, crosses above (touches and moves above), or crosses below
 

tradebook

New member
Thanks Merry, a scalper. Trading on and off for last 5 years. Tried to add to profile but wouldn't let me in about. I thought it was crosses, but kept getting an error when I added that specification. Will play with it more tomorrow. Thank you!
 

Similar threads

Top