File Includes: Indicator - Futures Roll Over
Category: Indicator > Miscellaneous
Very often you will need historical futures data so your indicators and/or trading systems work properly; the first few days a future contract is traded can not be analyzed because of lack of historical data. You will be able to create adjusted daily continuous future contracts by creating a new indicator. The Power Editor code for this Indicator is contained in the Futures Roll Over Indicator.
When you apply this indicator to a future contract it will export all the price data to a ASCII file with the name specified in the input Trgt. Here is what you will have to do to create a continuous contract:
1. Determine what day you want to roll over the future contract. This date can be the first trading day of the current contract or any other day you feel would be appropriate for the roll over. We will call this the D Date.
2. Create two charts, one with the new symbol formatted so the D Date is shown on the chart, and a second chart showing the expired contract with the D Date as the last day to be displayed.
3. Calculate the difference between the Open of D Date bar of the new contract and the Close of the D Date of the old contract. This value will be the adjust amount, do not disregard a negative number if you get one.
For example: If the open of the D Date for the December contract is 691.90 and the close of the D Date of the September contract is 684.05, the difference is 7.85.
4. After you calculate the indicator created should be applied to the chart with the expired contract specifying the path and file name as the input Trgt and the adjustment amount as the input Adjust. Once you apply the indicator, a file with the file name specified in the input Trgt with the adjusted data will be created.
5. What is left is to go to either your Omega Server or Omega Downloader and import this ASCII file into the current contract. For example, you would apply the indicator to the September contract of the S&P and import the resulting ASCII file to the December contract of the S&P.
You will not be able to create continuous contracts of Server data because it is not possible to import ASCII tick data into your server.
Adjust - adjustment amount
Trgt - file name
INPUTS: ADJUST(0), TRGT("C:\OMEGA\ROLL.TXT");
VAR: PS(0), TXT("");
TXT = NUMTOSTR(PRICESCALE,0);
PS = STRLEN(TXT) - 1;
IF BARNUMBER = 1 THEN BEGIN
FILEAPPEND(TRGT, NUMTOSTR(DATE,0) +","+ NUMTOSTR(TIME,0) +","+
NUMTOSTR(OPEN+ADJUST,PS) +","+ NUMTOSTR(HIGH+ADJUST,PS) +","+
NUMTOSTR(LOW+ADJUST,PS) +","+ NUMTOSTR(CLOSE+ADJUST,PS) +","+
NUMTOSTR(VOLUME,0) +","+ NUMTOSTR(I,0)+NEWLINE);