Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Does anyone know how to place data from a study/indicator that is on one timeframe into a strategy using a different timeframe in TradeStation? Say, for example, I wanted to use a moving average and an RSI in combination to produce entry and exit signals for a custom strategy. If I'm trading on a 5-mintue chart and I want a 5-min moving average and a 5-minute RSI, piece of cake. But, what if I want to trade a 5-minute chart with a 5-minute moving average and an hourly RSI? I've seen that this is possible on other platforms, but is it doable in TradeStation? Thanks in advance!
Can you help answer these questions from other members on NexusFi?
ShadowFox, thanks for the response. I tried inserting the code similar to what you suggested:
XMA1(0),
XMA2(0);
XMA1 = xaverage(close of data2, 8);
XMA2 = xaverage(close of data2, 20);
Strangely, adding ^^^this^^^ code does not generate any error or warning messages by TDE, but it does remove all of the buy/sell orders in the strategy. Said another way - my strategy was previously producing the desired entry/exit signals, but adding this code caused the strategy to not produce ANY entry or exit signals. I can't figure out why these four little lines would have any effect on my order generation?
If you only added those 4 lines of code and did not change the logic of order fills at all, then that is a problem. Were XMA1 and XMA2 off data1 before and are you using those for your order entry settings? Its possible that there are no longer any valid trades based on the new logic. I like to add indicators with trade flags that should mimic my strategy and if I still generate signals in the indicator but not the strategy then something is definitely wrong. I hope that helps, but if not feel free to ping me with more details!
SolaFide
Longview, TX
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0
I was planning to make my order entries conditional on the values of the data2 moving averages but never got that far. Once I added the four lines of code mentioned, I validated the strategy and went back to the chart to find all of my entries and exits gone. Of course I went back and forth several times trying to figure out the problem but no luck. I never tried running XMA1 and XMA2 off of data1 but I'm sure that wouldn't be a problem. Can I ask you something? Obviously, by default, everything on the chart analysis feeds off of data1 without you having to specifically call it. But if you specify that certain inputs should feed from data2 (in this case the XMA's), do you need to tell the other inputs to use data1? Sorry if I sound like a total rookie and thanks for the help so far. I watched a couple of videos by a guy who runs a company called Markplex - he has some good stuff on there btw - about using a price series provider to do what I'm attempting to do but its some serious programming.
ABCTG
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629
SolaFide,
you do not have to tie the "other" code to data1. If you omit a specific data stream Tradestation will use Data1 by default.
How many data 2 bars do you have on the chart and what are you max bars back settings for the strategy? When you use multiple data streams all have to surpass the max bars back settings before the strategy will perform calculations. This could be a reason for not seeing any trades.
Regards,
ABCTG
SolaFide
Longview, TX
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0
ABCTG,
Regarding the data streams, that's what I assumed, but thank you for verifying.
On another note, thanks a million! It appears that the reason the trades signals weren't being generated was because the I had my max bars back ("maximum number of bars study will reference") set too high. I'm using 1-minute, look-inside-bar backtesting and wanted max bars back to be high as possible to get as accurate results as possible.
Now to figure out what a good max bars back setting is since I'm noticing that the higher I set it, the lower (and I'm assuming more realistic) my projected profit numbers are.
I don't know that I ever would have discovered that was the problem so thanks again!
ABCTG
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629
SolaFide,
my pleasure. You might be misunderstanding what the max bars back feature does.
This is basically the number of bars your code skips prior to the current bar to ensure it has enough bars to perform internal calculations.
If you are using a simple moving average with a length of 10 you will require 10 bars to compute it. Consequently your max bars back needs
to be 9 at least (9 prior bars plus the current bar). Anything less would raise a run time error message. Anything above that would (in this particular
example) only result in an unnecessary large part of your data set being skipped.
The TS Wiki has a very helpful article that should clear all questions.
Regards,
ABCTG
SolaFide
Longview, TX
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0
ABTCG,
I yeah I think I was misunderstanding that then. The title of the field is misleading. When you say "max bars back" you are referring to Studies->Edit Strategies->Properties for All-> General -> Backtesing Resolution -> "maximum number of bars study will reference." Correct?
Best,
Alex