Is this possible?
Where can I learn about this?
Using Multiple Symbols and Timeframes in a Strategy
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
I'll be a bit more specific.
I only want to trade one symbol. But in order to trade that symbol I need confirmation from another symbol.
I then need my entries and exits to be based on studies for the main symbol but those studies are based on different time frames.
Is this possible to do in Multicharts?
I only want to trade one symbol. But in order to trade that symbol I need confirmation from another symbol.
I then need my entries and exits to be based on studies for the main symbol but those studies are based on different time frames.
Is this possible to do in Multicharts?
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
Is there any sample code of global variables being used? I did a google search and didn't turn up much.
For instance I want to have a global variable that shows the Advancing vs. Declining NYSE stocks. Then I want to use that number to to determine whether I go long or short in the ES.
I want to use a 30 minute 20 period moving average on the ES for entry and an 8 period 5 minute moving average on the ES for the exit.
I am looking to fully automate My trading strategies that have lots of multiple chart, multiple time frame, multiple symbol parameters. Is multicharts the best solution for coding this? I have read that Java or C are the best languages to automate trading strategies.
What would be considered Multicharts biggest competition besides TS?
Thanks to anyone for the help.
For instance I want to have a global variable that shows the Advancing vs. Declining NYSE stocks. Then I want to use that number to to determine whether I go long or short in the ES.
I want to use a 30 minute 20 period moving average on the ES for entry and an 8 period 5 minute moving average on the ES for the exit.
I am looking to fully automate My trading strategies that have lots of multiple chart, multiple time frame, multiple symbol parameters. Is multicharts the best solution for coding this? I have read that Java or C are the best languages to automate trading strategies.
What would be considered Multicharts biggest competition besides TS?
Thanks to anyone for the help.
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 176
- Joined: 02 Feb 2008
- Location: Lausanne, Switzerland
- Has thanked: 9 times
- Been thanked: 5 times
You don't need GV to do this.
With data1 being defined as ES5min and data2 as ES30min, you would then code something like this:
inputs: length1, length2;
vars: 5min8periodMA(0), 30min20periodMA(0);
length1=8;
length2=20;
5min8periodMA = XAverage (Price,length1);
30min20periodMA(0)= XAverage (Price,length2)data2;
With data1 being defined as ES5min and data2 as ES30min, you would then code something like this:
inputs: length1, length2;
vars: 5min8periodMA(0), 30min20periodMA(0);
length1=8;
length2=20;
5min8periodMA = XAverage (Price,length1);
30min20periodMA(0)= XAverage (Price,length2)data2;
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
-
- Posts: 35
- Joined: 16 Nov 2009
- Contact:
flipflop,
Java, C++ and C#, C are far more complicated languages then easy language and in generel if you are not already a professional or have done extensive developement then thay would not be the right solution for you.
You use the datax parameter to indicated to you script what symbol to associate with data1 you do not assign a variable name to data1.
In you case in the chart load the 30 minute ES which will default to data1 then a reference to data1 in you script witll refer to the es 30 minute chart.
Java, C++ and C#, C are far more complicated languages then easy language and in generel if you are not already a professional or have done extensive developement then thay would not be the right solution for you.
You use the datax parameter to indicated to you script what symbol to associate with data1 you do not assign a variable name to data1.
In you case in the chart load the 30 minute ES which will default to data1 then a reference to data1 in you script witll refer to the es 30 minute chart.
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
Thanks for the response. Upon further research I agree that Easylanguage is the right solution for me.
I will also have to research the datax parameter further. I want the symbols and timeframes to be hard coded in the script and it sounds like you are saying this can be done??
I have also purchased the TS book that TJ recommended because I really can't find good documentation on certain easy language features I want to use.
Intrabarpersist is one topic I have searched for and can't find any clear answers to.
Again one simple sounding task I want to accomplish is the following:
* Buy limit order at 30 minute 8 period moving average.
This sounds so simple yet seems so difficult to achieve.
I will also have to research the datax parameter further. I want the symbols and timeframes to be hard coded in the script and it sounds like you are saying this can be done??
I have also purchased the TS book that TJ recommended because I really can't find good documentation on certain easy language features I want to use.
Intrabarpersist is one topic I have searched for and can't find any clear answers to.
Again one simple sounding task I want to accomplish is the following:
* Buy limit order at 30 minute 8 period moving average.
This sounds so simple yet seems so difficult to achieve.
-
- Posts: 35
- Joined: 16 Nov 2009
- Contact:
Here is a sample of code you are looking for.....let me know if the system makes money :>)
Code: Select all
{data1 = S&P 500 Futures -- five-minute continuous data}
{data2 = 10-Year-Treasury-Notes Futures -- five-minute continuous data}
{data3 = S&P 500 Futures -- daily closing prices using continuous data}
{data4 = 10-Year-Treasury-Notes Futures -- daily closing prices using continuous data}
{Note: times in EST}
inputs: entryFactor(3.0), exitFactor(5.0), length(30);
variables: interMarketSpread(0), histVolSP(0), histVolNotes(0), R(0),
weightSP(0.5), weightNotes(0.5), volBand(0);
if close[1] of data3 <> 0 and close[1] of data4 <> 0
then interMarketSpread = log(close of data1/close of data3) -
log(close of data2/close of data4);
if date <> date[1] and close[1] <> 0 and close[1] of data3 <> 0 and
close[1] of data4 <> 0
then begin
histVolSP = stdDev(log(close/close[1]),length) of data3;
histVolNotes = stdDev(log(close/close[1]),length) of data4;
R = coefficientR(log(close of data3/close[1] of data3),
log(close of data4/close[1] of data4), length);
if (square(weightSP) * square(histVolSP) + square(weightNotes) *
square(histVolNotes) + 2 * weightSP * weightNotes * R *
histVolSP * histVolNotes) > 0
then volBand = squareroot(square(weightSP) *
square(histVolSP) + square(weightNotes)*
square(histVolNotes) + 2 * weightSP * weightNotes *
R * histVolSP * histVolNotes);
end;
If time < 1700 or time > 2100
then begin
If interMarketSpread crosses above - entryFactor * volBand
then buy next bar on open;
If interMarketSpread crosses below entryFactor * volBand
then sell short next bar on open;
end;
If marketposition = 1
then begin
If interMarketSpread crosses above 0
then sell next bar on open;
If interMarketSpread crosses below -exitFactor * volBand
then sell next bar on open;
end;
If marketposition = -1
then begin
If interMarketSpread crosses below 0
then buy to cover next bar on open;
If interMarketSpread crosses above exitFactor * volBand
then buy to cover next bar on open;
end;
-
- Posts: 35
- Joined: 16 Nov 2009
- Contact:
Here is a sample of code you are looking for.....let me know if the system makes money :>). I'm not sure there is a way to "hard code" the symbols in the script.
{data1 = S&P 500 Futures -- five-minute continuous data}
{data2 = 10-Year-Treasury-Notes Futures -- five-minute continuous data}
{data3 = S&P 500 Futures -- daily closing prices using continuous data}
{data4 = 10-Year-Treasury-Notes Futures -- daily closing prices using continuous data}
{Note: times in EST}
inputs: entryFactor(3.0), exitFactor(5.0), length(30);
variables: interMarketSpread(0), histVolSP(0), histVolNotes(0), R(0),
weightSP(0.5), weightNotes(0.5), volBand(0);
if close[1] of data3 <> 0 and close[1] of data4 <> 0
then interMarketSpread = log(close of data1/close of data3) -
log(close of data2/close of data4);
if date <> date[1] and close[1] <> 0 and close[1] of data3 <> 0 and
close[1] of data4 <> 0
then begin
histVolSP = stdDev(log(close/close[1]),length) of data3;
histVolNotes = stdDev(log(close/close[1]),length) of data4;
R = coefficientR(log(close of data3/close[1] of data3),
log(close of data4/close[1] of data4), length);
if (square(weightSP) * square(histVolSP) + square(weightNotes) *
square(histVolNotes) + 2 * weightSP * weightNotes * R *
histVolSP * histVolNotes) > 0
then volBand = squareroot(square(weightSP) *
square(histVolSP) + square(weightNotes)*
square(histVolNotes) + 2 * weightSP * weightNotes *
R * histVolSP * histVolNotes);
end;
If time < 1700 or time > 2100
then begin
If interMarketSpread crosses above - entryFactor * volBand
then buy next bar on open;
If interMarketSpread crosses below entryFactor * volBand
then sell short next bar on open;
end;
If marketposition = 1
then begin
If interMarketSpread crosses above 0
then sell next bar on open;
If interMarketSpread crosses below -exitFactor * volBand
then sell next bar on open;
end;
If marketposition = -1
then begin
If interMarketSpread crosses below 0
then buy to cover next bar on open;
If interMarketSpread crosses above exitFactor * volBand
then buy to cover next bar on open;
end;
{data1 = S&P 500 Futures -- five-minute continuous data}
{data2 = 10-Year-Treasury-Notes Futures -- five-minute continuous data}
{data3 = S&P 500 Futures -- daily closing prices using continuous data}
{data4 = 10-Year-Treasury-Notes Futures -- daily closing prices using continuous data}
{Note: times in EST}
inputs: entryFactor(3.0), exitFactor(5.0), length(30);
variables: interMarketSpread(0), histVolSP(0), histVolNotes(0), R(0),
weightSP(0.5), weightNotes(0.5), volBand(0);
if close[1] of data3 <> 0 and close[1] of data4 <> 0
then interMarketSpread = log(close of data1/close of data3) -
log(close of data2/close of data4);
if date <> date[1] and close[1] <> 0 and close[1] of data3 <> 0 and
close[1] of data4 <> 0
then begin
histVolSP = stdDev(log(close/close[1]),length) of data3;
histVolNotes = stdDev(log(close/close[1]),length) of data4;
R = coefficientR(log(close of data3/close[1] of data3),
log(close of data4/close[1] of data4), length);
if (square(weightSP) * square(histVolSP) + square(weightNotes) *
square(histVolNotes) + 2 * weightSP * weightNotes * R *
histVolSP * histVolNotes) > 0
then volBand = squareroot(square(weightSP) *
square(histVolSP) + square(weightNotes)*
square(histVolNotes) + 2 * weightSP * weightNotes *
R * histVolSP * histVolNotes);
end;
If time < 1700 or time > 2100
then begin
If interMarketSpread crosses above - entryFactor * volBand
then buy next bar on open;
If interMarketSpread crosses below entryFactor * volBand
then sell short next bar on open;
end;
If marketposition = 1
then begin
If interMarketSpread crosses above 0
then sell next bar on open;
If interMarketSpread crosses below -exitFactor * volBand
then sell next bar on open;
end;
If marketposition = -1
then begin
If interMarketSpread crosses below 0
then buy to cover next bar on open;
If interMarketSpread crosses above exitFactor * volBand
then buy to cover next bar on open;
end;