Importing of multiple time frame "indicator symbols" from Tradestation issue

I am having such a hard time getting multiple periodicity "indicators symbols" to work with a 5min database. I used to have this working with hourly bars, but we switched to 10min bars. (We had to create a database in the form of 5min bars because there is no 10min option, and then just have Amibroker create 10min bars from the 5min bars.) I created a download like for the ASCII format files that I use during the import of the csv data, and the csv files that I imported:

I am using only a test 5min database with just AAPL data for this illustration....

I first used the "Price_5min_Aux1_Aux2.format" file to import the "AAPL.csv" file in as 200,000 bars of 5min data. You can see that it is TimeShifted by -0.08333333333333 because I am using TradeStation data which uses end-of-bar time stamps, so this correctly adjusts for that. This data imports fine, and plots fine. I am able to create 10min bars with this 5min data. So far so good....

Next I want to overlay some proprietary support and resistance lines that we generate in TradeStation. We have multiple time frames for this, where each has its own csv file that we import as a separate symbol. To keep it simple here we will only be using the daily time-frame. I use the "MrjRes-Daily.format" file to import the "AAPL_Daily_MjrRes.csv" data. Notice how this one is time shifted by -6.5 hours to compensate for the end-of-bar Tradestation time stamps.

Then I link everything together with the following code so that I can plot the "indicator symbol" to overlay plot on top of price (green circles.)


_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


UseDailyLevels = 1;

preDaily_MjrSup1 = Foreign( Name() + "_Daily_MjrSup", "O" , 2);
preDaily_MjrSup2 = Foreign( Name() + "_Daily_MjrSup", "H" , 2);
preDaily_MjrSup3 = Foreign( Name() + "_Daily_MjrSup", "L" , 2);
preDaily_MjrSup4 = Foreign( Name() + "_Daily_MjrSup", "C" , 2);

Daily_MjrSup1 = IIf( UseDailyLevels, preDaily_MjrSup1 , 0);
Daily_MjrSup2 = IIf( UseDailyLevels, preDaily_MjrSup2 , 0);
Daily_MjrSup3 = IIf( UseDailyLevels, preDaily_MjrSup3 , 0);
Daily_MjrSup4 = IIf( UseDailyLevels, preDaily_MjrSup4 , 0);

PlotShapes(IIf( UseDailyLevels, shapeHollowSmallCircle, shapeNone),colorGreen,  0, preDaily_MjrSup1, Offset=0);
PlotShapes(IIf( UseDailyLevels, shapeHollowSmallCircle, shapeNone),colorGreen,  0, preDaily_MjrSup2, Offset=0);
PlotShapes(IIf( UseDailyLevels, shapeHollowSmallCircle, shapeNone),colorGreen,  0, preDaily_MjrSup3, Offset=0);
PlotShapes(IIf( UseDailyLevels, shapeHollowSmallCircle, shapeNone),colorGreen,  0, preDaily_MjrSup4, Offset=0);

Here is a snapshot of the Tradestation chart:

image

And here is a snapshot of the Amibroker chart:

image

There are some similarities here, but it is ultimately way off when you get down and study exact prices and datetimes.

I have read through tons of forum posts and also the manual on this subject, and I have been working since last week trying to get it right before I asked for help. Any insight would be appreciated.

Should read:
I created a download LINK for the ASCII format files that I use during the import of the csv data, and the csv files that I imported:

One thing that I see is in your MrjRes-Daily.format file. The $FORMAT line contains ‘Open, Open, Low, Close’ instead of ‘Open, High, Low, Close’.

I also don’t understand the -6.5 hour time shift in that file. All of the bars in AAPL_DailyMjrSup.csv have a time stamp of 15:00. The time shift makes that 8:30, which is outside of normal market hours. That may be causing an alignment issue.

1 Like

I am in Central Standard Time (CST), so 8:30am is market open, and 15:00 is market close. I use Tradestation data that stamps everything end-of-bar. So I am time-shifting the bars backward to compensate.

Open, Open, Low, Close..... DOH!!!!

Now let me correct that and see if things line up

You might want to look closely at the two time shifts. One is shifted by exactly -6.5 hours and the other is shifted by an inexact fraction representing -5 minutes. The time stamps from the fractional shift may not exactly equal a 5-minute interval.

You can use the MilliSec() and MicroSec() functions to check time stamps if you think that may be the issue.

good advice. Checking now.....

This is the solution. I don't know why I cannot see the place to make it so.

The question was initially posted in a wrong section (was in Announcements & Discussions).
Seems fixed now, so you should be able to mark @bigalgator answer as a solution.

1 Like