Using ATR from another time period for adaptive stops
Author: M635
Creation Date: 3/28/2009 2:59 PM
profile picture

M635

#1
I'm guessing this can be done, just don't know how to do it on my own, using cut and paste to help learn programing.

I want to grab an ATR value from another time period (daily period) and use it as the base for calculating fixed stop and trailing stops in another period (3 Min.).
CODE:
Please log in to see this code.

Besides learning how I can do this are there any down sides as far as processing time in a realtime (streaming) scan of a dataset with several symbols?

All help, advice, pro's and con's welcomed.
profile picture

Eugene

#2
QUOTE:
I want to grab an ATR value from another time period (daily period) and use it as the base for calculating fixed stop and trailing stops in another period (3 Min.).

See WealthScript Programming Guide > Multi-Time Frame Analysis. Example:
CODE:
Please log in to see this code.
profile picture

M635

#3
OK,, I think I get it,, I'll be back if I can't make it work.

Thanks Eugene!!
profile picture

M635

#4
OK, back with a question,

CODE:
Please log in to see this code.


I have set the daily time scale and created dailyLRS, this seemed to run ok in my script.

CODE:
Please log in to see this code.



Now I want to create a smothed average of it as part of a criteria and I get the following message, "SMA is a type but is used as a variable"

Tried creating the smoothed average at the same point I created the daily data series but failed to get smoothed average to work there.

What am I doing wrong?

profile picture

Eugene

#5
QUOTE:
What am I doing wrong?

Here's a clue for you - compare a working line:
CODE:
Please log in to see this code.

With the failing one:
CODE:
Please log in to see this code.

What does it miss?

See WealthScript Guide, DataSeries > Accessing a Single Value from a DataSeries.
profile picture

M635

#6
Thanks Eugene,

here's what i ended up with,
CODE:
Please log in to see this code.


CODE:
Please log in to see this code.

Seems to be giving me the results I expect, if you see anything that looks incorrect please let me know.

After thinking about this, I am wondering if I am missing an int statement to gather enough bars to make my 60 minute indicators. I am working in a 10 minute time scale.

I'll be back with more questions I'm sure as I continue to flesh out this strategy.

Thanks again for pointing me in the right direction!
profile picture

M635

#7
Where do I find a list of the available colors, fillcolor and paintcolor syntax? Looked in the quick ref and wealthscript ref but came up empty. I noticed in rule builder a transparency factor is available as well.
profile picture

Eugene

#8
QUOTE:
Where do I find a list of the available colors, fillcolor and paintcolor syntax? Looked in the quick ref and wealthscript ref but came up empty.

For sure, because QuickRef is no MSDN copycat. WealthScript in V5 speaks C#, therefore just Google for "System.Color", "Color.FromArgb" etc etc.
profile picture

M635

#9
OK,, Back again,

Got 12 hours in today hammering away at this strategy, learned a lot but having trouble with this last tweak,,, well maybe not the last tweak:-)
Everything worked OK until I tried to add in a daily criteria to a script, I am running at 3 minute bars. A 30 minute compressed data intraday data access and condition statement worked great, then I added a daily/intraday data and condition statement and now have no entries when I should be seeing entries.

Below are the relivant snipets setting up the daily and compressed scales and data series:
CODE:
Please log in to see this code.

And here is the conditional statements:
CODE:
Please log in to see this code.


I'm guessing that I need to harvest the bars to create the Daily scale, just don't can't figure out how to do it.

Remember, I'm not a coder but the fog is begining to lift.

Oh yeah,, one more thing,, sorry I asked about the colors,,sheesh talk about drinking from a firehose;-)

As always your help is greatly appreciated!!!
profile picture

Eugene

#10
Upon noticing the multiple calls to SetScale*, let me warn you:
QUOTE:
Warning!

Due to a bug that results in inconsistent synchronization, until Version 5.4 is released, use SetScale/Synchronize for only one other timeframe in a script.
profile picture

M635

#11
Roger that,, standing by for 5.4!!!

Thanks Eugene!!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).