[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unidentified subject!



PureBytes Links

Trading Reference Links

At 5:01 PM +0100 11/23/99, L'Alchimista wrote:

I would use the method mostly like your Example3 but with important changes.

SwingHigh and SwingLow functions are "Simple" functions so must be 
called on every bar to work correctly. So you need to equate each of 
them to a variable on every bar and use those variables in the 
condition statements.

    SHa = SwingHigh(1,rd2,1,2);
    SHb = SwingHigh(1,rd2,1,15);

    etc.

You cannot use them inside of a conditional statement since if during 
the evaluation of the conditional, it becomes clear that the 
conditional cannot be true, then the rest of the statement will not 
be evaluated so the simple functions inside the conditional might not 
be evaluated.

Then you need to set a flag on the first condition being true:

   if Condition1 then Flag1 = TRUE;

then you need to increment a counter counting bars since Flag1
was set:

   Count = iff(Flag1, Count + 1, 0);

Then you need to check if Flag1 = TRUE and Count <= 10 and the
second condition is true to buy:

    if Flag1 and Count <= 10 then begin
       if Condition2 then begin
          Buy....
          Flag1 = FALSE;
       end;
    end else
       Flag1 = FALSE;

Note that you need to set Flag1 to FALSE if either the second
condition is true or the count exceeds 10.

Finally, are you sure you really understand how the SwingHigh and 
SwingLow functions work? They only return the value some number of 
bars after the high/low is past so are pretty much useless in trading 
systems.

And they call it EasyLanguage....

Hope this has been helpful.

Bob Fulks

-----

>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;