Changing time frames in strategy
Author: tn
Creation Date: 8/24/2011 4:55 AM
profile picture

tn

#1
Hey there,

I'm new to WealthLab and I have some questions.
My Basis is a 5-minute chart. I know how to change the time frame to 15 minutes with the SetScaleCompressed-Method. I would like to turn back to 5 minutes if something happens in the 15 minutes chart.
At the moment a loop counters up the 15-minutes bars. If a trigger is set, I would like to compare the three 5-minute bars from this 15-minute bar. By now, I don't know how to specify these bars.

I hope you can understand what I mean!

Thanks in advance!
Tobias
profile picture

Eugene

#2
Hi,

Could you be more specific and detailed about the coding task? Especially this part: "compare the three 5-minute bars from this 15-minute bar." It's not clear.
profile picture

tn

#3
OK, i'll try! ;)

If the high of a 15 minute bar - let's say it's the 10:30 bar - is higher than a bar ago, I would like to check the 5 minute bars 10:20, 10:25 and 10:30 to set an entry.

CODE:
Please log in to see this code.
profile picture

Eugene

#4
I think you're after this:
CODE:
Please log in to see this code.
profile picture

Cone

#5
Keep in mind that all trading must be performed in the chart's base time scale, i.e., you must RestoreScale() before trading and access (and plot) your 15-minute indicators in the 5-minute interval by applying Synchronize().
profile picture

GSV_pusher

#6
Hello, i am not sure posting my inquiry here, but the topic and content seems to match with my problem.
I am constructing a multi-frame trading system, and WL prog. guide helped me a lot, but i still can not realize how to obtain data from higher frame Data Series.
I can draw daily data series on my intraday chart and they can trigger the trades, but... how to obtain, for example, value of a daily Data Series from any DAY backwards? I use SetScaleDaily(), RestoreScale() and Synchronize() methods but it doesn't help me.

i expected smth like this:
....
SetScaleDaily();
DataSeries myDataSeries = xxx;//my data series on daily bars
RestoreScale();
ranges = Synchronize(ranges);

for (int bar = 1; bar < Bars.Count; bar++)//my trading loop on intraday bars
........
double ValueThreeDaysAgo = myDataSeries[bar-3];//here i want to get the value 3 days ago but not 3 intraday bars ago, but the code takes the value three intraday bars ago

So it doesn't work.
Graphically I showed my problem on the picture attached.

Thank in advance.
profile picture

Eugene

#7
Hi,

This KB article shows a design pattern applicable to your problem:

Intraday / Multi-Time Frame | GetIntradayBar and the similar functions

Hope this helps.
profile picture

Cone

#8
Depending on the application, there's also a simpler way just by finding the bar number that you need. Here's how.,

CODE:
Please log in to see this code.
profile picture

GSV_pusher

#9
I am pleasantly surprised by prompt feedback and internally happy that a decision exists :)
I will try both the ways and check.
Thanks.
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).