NexusFi: Find Your Edge


Home Menu

 





Multiple Timeframe Strategy


Discussion in TradeStation

Updated
    1. trending_up 4,911 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
 

Multiple Timeframe Strategy

 
SolaFide
Longview, TX
 
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0

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?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
 
 
 
ShadowFox's Avatar
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
Posts: 129 since Jun 2020
Thanks Given: 70
Thanks Received: 157

You should be able to add another data series to the chart (same symbol, but 60 minute timeframe), then call data2 in the strategy.

So you would have two MA and RSI values

MA1 = Average(close,9);
MA2 = Average(close of data2,9);
RSI1 = Average(close,14);
RSI2 = Average(close of data2,14);

Visit my NexusFi Trade Journal
 
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


SolaFide,

the information in this link might help you:


Regards,

ABCTG


SolaFide View Post
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!


Follow me on Twitter
 
SolaFide
Longview, TX
 
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0

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?

 
 
ShadowFox's Avatar
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
Posts: 129 since Jun 2020
Thanks Given: 70
Thanks Received: 157

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!

Visit my NexusFi Trade Journal
 
SolaFide
Longview, TX
 
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0


ShadowFox View Post
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!


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   is a Vendor
 
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 View Post
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.


Follow me on Twitter
 
SolaFide
Longview, TX
 
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0


ABCTG View Post
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


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   is a Vendor
 
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 View Post
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!


Follow me on Twitter
 
SolaFide
Longview, TX
 
Posts: 6 since Dec 2016
Thanks Given: 2
Thanks Received: 0



ABCTG View Post
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


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


 



Last Updated on February 5, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts