Turin + Italy
Posts: 194 since Feb 2020
Thanks Given: 24
Thanks Received: 129
|
Hi,
I would like to improve this Trading System which I think is interesting,
I would like, if possible, to reduce the false signals in the very narrow lateral phases;
I was thinking of a filter of this type, to reduce these false signals:
after a Buy signal, the Short signal has to wait for at least 3 candles;
after a short signal, the Buy signal must wait for at least 3 candles.
After 3 candles, the Trading System proceeds normally as always.
This is the formula:
---------------------------------------------------
Inputs: Length(30), len2(4), len3(4), protStop(1300);
vars:
daysintrade(0),atr(0),ptargmult(1),longliqpt(0), shortliqpt(9999999), protlongstop(0), protshortstop(0), lowestlow3(0),highesthigh3(0),bed
(0),sed(0),stb(0), sts(0);
atr=avgtruerange(Length);
lowestlow3=lowest(low,len2);
highesthigh3=highest(high,len3);
bed=0;
sed=0;
if (close>=close[1]) then sed=1;
if (close<=close[1]) then bed=1;
if(bed=1) then
begin
stb=open of tomorrow +.5*(highesthigh3-lowestlow3);
sts=open of tomorrow -(highesthigh3-lowestlow3);
end;
if(sed=1) then
begin
stb=open of tomorrow +(highesthigh3-lowestlow3);
sts=open of tomorrow -.5*(highesthigh3-lowestlow3);
end;
if (marketposition=1 and barssinceentry=0) then
protlongstop=entryprice(0)-3*atr[1];
if (marketposition=-1 and barssinceentry=0) then
protshortstop=entryprice(0)+3*atr[1];
if (marketposition<>marketposition(1)) then
begin
ptargmult=1;
longliqpt=0;
shortliqpt=999999;
end;
if (marketposition=1 and high[1]>entryprice(0)+ (3*atr[1])) then
begin
longliqpt=entryprice(0);
end;
if (marketposition=-1 and low[1]<entryprice(0)- (3*atr[1])) then
begin
shortliqpt=entryprice(0);
end;
buy tomorrow at stb stop;
sellshort tomorrow at sts stop;
SetStopLoss(protStop);
---------------------------------------------------
I thank you in advance.
|