Does anyone have a sample of a simple signal based on two datastreams data1 and data2?
For me data1/data2 does not work and I cant find out why!
Is it possible that if a function is not coded properly then the signals based on this function do not work with data1 and data2 ??
Is it possible to reference past values in data2 ?
e.g. "average(price, length)[1] of data2"
data1, data2
- konstantin
- Posts: 69
- Joined: 24 Dec 2007
- Location: Europe
- Has thanked: 2 times
- Been thanked: 1 time
Re: data1, data2
Does anyone have a sample of a simple signal based on two datastreams data1 and data2?
For me data1/data2 does not work and I cant find out why!
Is it possible that if a function is not coded properly then the signals based on this function do not work with data1 and data2 ??
Is it possible to reference past values in data2 ?
e.g. "average(price, length)[1] of data2"
when refering to dataX ....
use:
close of data2
high of data3
highest(H,4) of data6
highD(0) of data 17
good luck
- konstantin
- Posts: 69
- Joined: 24 Dec 2007
- Location: Europe
- Has thanked: 2 times
- Been thanked: 1 time
Re: data1, data2
Thank you.
when refering to dataX ....
use:
close of data2
high of data3
highest(H,4) of data6
highD(0) of data 17
good luck
This is what I use, but it does not work. The same code works if I use only one data, but when I use data1 and data2 the code does not work.
Is it possible to reference past values in data2 ?
e.g. "average(price, length)[1] of data2"
Can all functions be used for for data1, data2 ?
data1 and data2
I have no problems using those terms ... here are 2 examples I use.
Code: Select all
var:
counter(0);
if time = SessionFirstBarTime(0,1) then counter = 0;
condition1 = close of data1 > high[1] of data2;
condition2 = close of data2 < Low[1] of data1;
if condition1 then counter = counter+1 else if condition2 then counter = counter-1;
plot1(counter);
plot2(0);
Code: Select all
inputs:
up(70),
dn(60);
plot1(c of data1 - c of data2);
plot2(up);
plot3(dn);
- konstantin
- Posts: 69
- Joined: 24 Dec 2007
- Location: Europe
- Has thanked: 2 times
- Been thanked: 1 time
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- konstantin
- Posts: 69
- Joined: 24 Dec 2007
- Location: Europe
- Has thanked: 2 times
- Been thanked: 1 time
Could someone test this simple test-code on 2 Datastreams?
Maybe I make a very stupid mistake in the code.
Use any Long exit signal:
inputs: price(close), length(20), rsilength(14);
variables: MAData2(0), Trend(0), EntryData1(0), RSIEntry(0);
MAData2 = average(price, length) of data2;
EntryData1 = rsi(price, rsilength) of data1;
{Trend}
If currentbar of data2 > 0 then begin
if MAData2 > MAData2[1] then Trend = 1;
if MAData2 <= MAData2[1] then Trend = 0;
end;
{Entry}
If currentbar of data1 > 0 then begin
if EntryData1 > EntryData1[1] and EntryData1[1] <= EntryData1[2] then RSIEntry = 1
else
RSIEntry = 0;
end;
if Marketposition = 0 then begin
if Trend = 1 and RSIEntry = 1 then
buy ( "Buy" ) next bar at Market ;
end;
Maybe I make a very stupid mistake in the code.
Use any Long exit signal:
inputs: price(close), length(20), rsilength(14);
variables: MAData2(0), Trend(0), EntryData1(0), RSIEntry(0);
MAData2 = average(price, length) of data2;
EntryData1 = rsi(price, rsilength) of data1;
{Trend}
If currentbar of data2 > 0 then begin
if MAData2 > MAData2[1] then Trend = 1;
if MAData2 <= MAData2[1] then Trend = 0;
end;
{Entry}
If currentbar of data1 > 0 then begin
if EntryData1 > EntryData1[1] and EntryData1[1] <= EntryData1[2] then RSIEntry = 1
else
RSIEntry = 0;
end;
if Marketposition = 0 then begin
if Trend = 1 and RSIEntry = 1 then
buy ( "Buy" ) next bar at Market ;
end;
I use this:
...with 2 or more Datastreams.
Code: Select all
inputs: DataSeries1( Close of data1 ), DataSeries2( Close of data2 ) ;
inputs: DataSeries3( Close of data3 ), DataSeries4( Close of data4 ) ;
Plot1( DataSeries1 - DataSeries4, "SprdDiff1", red );
Your problem is with your input variable "price(close)". The way you define it, means your input value is the close of data1, meaning the close of data1 is always used everywhere you reference the price input variable.Could someone test this simple test-code on 2 Datastreams?
Maybe I make a very stupid mistake in the code.
Use any Long exit signal:
inputs: price(close), length(20), rsilength(14);
variables: MAData2(0), Trend(0), EntryData1(0), RSIEntry(0);
MAData2 = average(price, length) of data2;
EntryData1 = rsi(price, rsilength) of data1;
{Trend}
If currentbar of data2 > 0 then begin
if MAData2 > MAData2[1] then Trend = 1;
if MAData2 <= MAData2[1] then Trend = 0;
end;
{Entry}
If currentbar of data1 > 0 then begin
if EntryData1 > EntryData1[1] and EntryData1[1] <= EntryData1[2] then RSIEntry = 1
else
RSIEntry = 0;
end;
if Marketposition = 0 then begin
if Trend = 1 and RSIEntry = 1 then
buy ( "Buy" ) next bar at Market ;
end;
For example, looking at the statement:
MAData2 = average(price, length) of data2;
and replacing it with the real value of price, translates to:
MAData2 = average(close of data1, length) of data2;
which doesn't make sense and the "of data2" part is ignored.
- Fanus
- konstantin
- Posts: 69
- Joined: 24 Dec 2007
- Location: Europe
- Has thanked: 2 times
- Been thanked: 1 time