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

Re: formula for an indicator to display no. of whipsaws



PureBytes Links

Trading Reference Links

Hello Adam,
No sure if you are working with intraday or daily data,
If your system enters and exits on the same bar, I_MarketPosition and
I_CurrentContracts will plot 0, and when you look at the chart under
the bar it shows a 0 indicating you are flat.
If you look in the System Report: Performance Summary under the Total
# of trades that trade will count as 1.
This code only counts entries that make it to the next bar and are
marked on the chart with a 1 or -1, subtract this number from Total #
of trades to get number of whipsaws.
vars: Count1(0), Count2(0);
if currentbar>1 then begin
Count1 = barnumber-I_CurrentContracts;
if Count1 = Count1[1]  then begin
Count2 = Count2 + 1;
end;
Plot1(Count2,"Count2");
end;


AH> I'm currently looking at break-out systems where there is a huge propensity for 
AH> whipsaws, by which in my little world I mean the number of times my break-out 
AH> stops above and below the market both get hit on the same day.

AH> To make it obvious on the screen, I want to have an indicator showing the 
AH> cumulative number of days with whipsaws.

AH> I got so far but am stuck since TS won't let me put system info formulae into a 
AH> study:

AH> vars: count(0);
AH> if EntryDate(Date) = EntryDate(Date[1]) then
AH>         count = count + 1;
AH> Plot1(count, "whipsaws");


AH> Is this the end of the road for my plans to conquer the markets, or is there a 
AH> way of doing it properly?

AH> Just in case the code looks dumb to you, I just want to point out I'm on TS4 :)
 



-- 
Best regards,
 SC                            mailto:secaseba@xxxxxxxxxx