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

RE: LRW strategy works........but its doing bizare stuff



PureBytes Links

Trading Reference Links

Gary , ta for that , works great now , i used you suggestion of saving the
high and low to a variable at the time my order was placed. Works a treat.
Cheers
:O)
Cameron

new code is below

............................................................................
....................


{LrgRangeRunaway
looks for a large range day that breaks new highs/lows for avgtrue range so
many days ago and opens at the bottom and closes at the top or visa/versa
Writen by Cameron Jones
}

Inputs:
	buyorsell(0),{buys only = 1 , sell only = -1 , both = 0}
	RangePercentFilter(25),{25 percent larger range days than x number of
ranges ago is default}
	NumberofDaysback(3), {number of days back to test the range}
	LongProfitTarget(4000),{long profit target}
    ShortProfitTarget(5000),{short profit target}
	Stoploss(2000),{duh}
	bizaroflag(1); {bizaroflag -1 for opposite signals}



Vars:Rangeval(0),
	highago(0),
	lowago(0),
	Debug(0);



if currentbar > 20 then begin

if bizaroflag <> -1 then begin

Rangeval=AvgTrueRange(NumberOfDaysBack)[1]+AvgTrueRange(NumberOfDaysBack)[1]
*RangePercentFilter/100;
	if debug = 1 then Print (Rangeval,range);
	if range>Rangeval and high >
highest(high,Numberofdaysback)[1]+AvgTrueRange(NumberOfDaysBack)[1]  and
buyorsell <>-1 and close > open then begin
		buy at close;
		highago = high[1];
        lowago=low[1];
    end;
	if marketposition = 1 then setprofittarget(longProfitTarget);

	if marketposition = 1 then sell next bar at lowago stop;


	if range>Rangeval and low <
lowest(low,Numberofdaysback)[1]+AvgTrueRange(NumberOfDaysBack)[1]  and
buyorsell <>1 and close < open then begin
		sell at market;
		highago = high[1];
        lowago=low[1];
    end;

	if marketposition = -1 then setprofittarget(shortProfitTarget);

	if marketposition = -1 then buy next bar at highago stop;

	setstoploss(stoploss);
end;

if bizaroflag = -1 then begin

Rangeval=AvgTrueRange(NumberOfDaysBack)[1]+AvgTrueRange(NumberOfDaysBack)[1]
*RangePercentFilter/100;
	if debug = 1 then Print (Rangeval,range);
	if range>Rangeval and high >
highest(high,Numberofdaysback)[1]+AvgTrueRange(NumberOfDaysBack)[1]  and
buyorsell <> -1 and close > open then begin
		sell at close;
		highago = high[1];
        lowago=low[1];
    end;

	if marketposition = 1 then setprofittarget(longProfitTarget);

	if marketposition = 1 then sell next bar at lowago stop;


	if range>Rangeval and low <
lowest(low,Numberofdaysback)[1]+AvgTrueRange(NumberOfDaysBack)[1]  and
buyorsell <> 1 and close < open then begin
		buy at market;
		highago = high[1];
        lowago=low[1];
    end;

	if marketposition = -1 then setprofittarget(shortProfitTarget);

	if marketposition = -1  then buy next bar at highago stop;

	setstoploss(stoploss);
end;


end;

-----Original Message-----
From: Gary Fritz [mailto:fritz@xxxxxxxx]
Sent: Sunday, January 25, 2004 2:14 PM
To: camacazi@xxxxxxxxxxx
Subject: Re: LRW strategy works........but its doing bizare stuff


Whups, my bad.  I was reading "highest(high,barssinceentry+1)"
where you had high[barssinceentry+1].  So MaxTradeHigh and
MinTradeLow aren't what you want.

So you want the High or Low of the bar where the order was
placed.  Right?  Then either store that High or Low when you
place the order, and refer to that, or use "at$ High" and "at$
Low" to refer to the High/Low of the order bar.  See TS online
help for explanation of at$.

Gary


---
---