I would like to create a 'mini index' of my own and trade this basket against another individual stock.
I would like to use the Pairs TRading strategy as a base. So I'm guessing I just need to replace 'stock1' with the basket. Is there an example on how to do this, and is it relatively easy to do?
Thanks
Size:
Color:
Maybe this could be helpful?
EDIT 08/29/2017:
Wealth-Lab User Guide > Index-Lab® chapter
Size:
Color:
Thanks Eugene, reckon that will help..... possibly another silly question but if I just create an index to global memory, can I just call the name of the index in the pair strategy and a buy/sell order will execute accordingly?
Size:
Color:
This technique illustrates the creation of a composite
DataSeries. As far as I understand your idea, you'd like to have that index as a virtual
Bars object. Here's how to build and plot it using the closing price of the "index". Add this after "
PlotSeries( idxPane..." and before the main loop:
CODE:
Please log in to see this code.
It's up to you to experiment with trading against this
Bars bars in a pair trade strategy.
Size:
Color:
Thanks Eugene, I've just tried the IndexOnTheFly example to create the index, and it seems I am having some success. A couple of things though. After I set the initial 4 stocks in the index (as per the example) It doesnt seem to change if I change the stocks in the index after that.
Also, I have the same symbols in Yahoo sourced EOD data, as well ASCII itnraday data. How can tell it which one to take the data from. at the moment the data only goes back a few years, so Im not sure which source it is using....
From what I can see it is currently using the intraday data (judging by the period of data showing) but when I apply it to intraday data, it doesnt break down to the intraday closes....
Thanks,
Size:
Color:
Look up the missing pieces in the QuickRef:
QUOTE:
It doesnt seem to change if I change the stocks in the index after that.
ClearGlobals()
QUOTE:
How can tell it which one to take the data from.
GetExternalSymbol() overloaded call
Size:
Color:
Thanks Eugene, I just removed the intraday data for now to keep it simple for myself, Ive tried adding ClearGlobals(); betweem a number of lines, but not sure exactly where to put it....
CODE:
Please log in to see this code.
Size:
Color:
Wait, hold the phone, I added it right at the end, it updates now
Thanks Eugene
Size:
Color:
Next Question, now that I have my "My Index" How do I get it
to plot in my other strategy as you suggested with the code above? I am getting an error, could not load data for symbol My Index.
execute a trade on "My Index"? I dont seem to be able to call it as a regular stock... or do I have to create orders for each stock ?
Size:
Color:
here is the code as I have it currently.
CODE:
Please log in to see this code.
Size:
Color:
I think I overlooked something, sorry. There's probably no way to put the "virtual index" we've just built into a DataSet on-the-fly. Hence we can't refer to it in SetContext(). But it can work out if you
export the Bars object to an ASCII file, create a new ASCII DataSet, and do your pair trading using that symbol.
Size:
Color:
starting to get a bit tricky.. I guess the system would work, jsut using the close of eack of them.
The system currently refers to 2 stocks and the Ratio in the following way
CODE:
Please log in to see this code.
Could it just be as easy as addind Stock3, stock4 and then adjust the Actual Ratio Accordingly?
CODE:
Please log in to see this code.
and then somehow have the order entry reflect these ratios?
Would this method be easier than your above post? Im dealing with extremely limited coding abilities here....
Size:
Color:
At first glance, sounds like your method may work for whatever you envision since only the symbols that actually present in a DataSet are traded.
Size:
Color: