PureBytes Links
Trading Reference Links
|
I'm trying to design a MultipleTimeFrameSystem on futures data , plotting as
Data1 the shortest time frame (Data1 = 5min) and as Data2 the longest time
frame (Data2 = 30min).
My system must look first for a condition in Data2(the longest) and then
search
for a condition on Data1(the shortest) : how can I achieve this goal ??
I should specify that the two Conditions don't have to be necessarily on
the same Bar !
CondData2(longest time frame) must be first and CondData1(shortest) can be
on the same bar or even 10 bars later (but possibly no more then 10).
Is a "IF CondData2 THEN BEGIN IF CondData1 then Buy" correct ?(Example1)
Do I need , otherwise, an MRO function ?
Like "IF MRO(CondData2,10,1)>-1 or =0 THEN BEGIN IF CondData1 then Buy"
(Example2)
Or should I use Arrays ??
Unfortunately I noted that both Examples 1&2 get the same results . Where's
the mistake then ?
Any help would be appreciated...
Thanks
Example1
Inputs:Len(14);
Vars:rd1(0),rd2(0);
rd1=RSI(C,Len) of Data1;
rd2=RSI(C,Len) of Data2;
If SwingHigh(1,rd2,1,2)<SwingHigh(2,rd2,1,15) and SwingHigh(1,rd2,1,2)<>-1
then Begin
If SwingHigh(2,rd1,1,15)>0 and SwingHigh(1,rd1,1,2)<SwingHigh(2,rd1,1,15)
and SwingHigh(1,rd1,1,2)<>-1 then Sell next bar at market;End;
If SwingLow(1,rd2,1,2)>SwingLow(2,rd2,1,15) and SwingLow(2,rd2,1,15)<>-1
then Begin
If SwingLow(2,rd1,1,15)<0 and SwingLow(1,rd1,1,2)>SwingLow(2,rd1,1,15) and
SwingLow(2,rd1,1,15)<>-1 then Buy next bar at market;End;
Example2
Inputs:Len(14);
Vars:rd1(0),rd2(0);
rd1=RSI(C,Len) of Data1;
rd2=RSI(C,Len) of Data2;
If MRO(SwingHigh(1,rd2,1,2)<SwingHigh(2,rd2,1,15) and
SwingHigh(1,rd2,1,2)<>-1,5,1)=0 then Begin
If SwingHigh(2,rd1,1,15)>0 and SwingHigh(1,rd1,1,2)<SwingHigh(2,rd1,1,15)
and SwingHigh(1,rd1,1,2)<>-1 then Sell next bar at market;End;
If MRO(SwingLow(1,rd2,1,2)>SwingLow(2,rd2,1,15) and
SwingLow(2,rd2,1,15)<>-1,5,1)=0 then Begin
If SwingLow(2,rd1,1,15)<0 and SwingLow(1,rd1,1,2)>SwingLow(2,rd1,1,15) and
SwingLow(2,rd1,1,15)<>-1 then Buy next bar at market;End;
Example3
Inputs:Len(14);
Vars:rd1(0),rd2(0),SL(0),BL(0);
rd1=RSI(C,Len) of Data1;
rd2=RSI(C,Len) of Data2;
If SwingHigh(1,rd2,1,2)<SwingHigh(2,rd2,1,15) and SwingHigh(1,rd2,1,2)<>-1
then Begin
SL=1;
If SL=1 and SwingHigh(2,rd1,1,15)>0 and
SwingHigh(1,rd1,1,2)<SwingHigh(2,rd1,1,15) and SwingHigh(1,rd1,1,2)<>-1 then
Sell next bar at market;
SL=0;End;
If SwingLow(1,rd2,1,2)>SwingLow(2,rd2,1,15) and SwingLow(2,rd2,1,15)<>-1
then Begin
BL=1;
If BL=1 and SwingLow(2,rd1,1,15)<0 and
SwingLow(1,rd1,1,2)>SwingLow(2,rd1,1,15) and SwingLow(2,rd1,1,15)<>-1 then
Buy next bar at market;
BL=0;End;
|