entry AND exit on day of signal

Questions directed to our Support Team. Responses can be expected within 24 hours.

Re: entry AND exit on day of signal

Postby Kevin_in_GA » Sun Feb 26, 2012 10:27 pm

Thanks, Pete. Great work. I wanted to check one thing before closing this discussion. In the Custom Formulas I used:

Code: Select all
parm1 = parameter("parm1");
parm2 = parameter("parm2");
DAILYGAPFILL =
hadalert(
OPEN < ref(close, -1)*parm1 // TODAY'S OPEN AT LEAST X% BELOW YESTERDAY'S CLOSE
and CLOSE*MOV(VOLUME,30,SIMPLE) > 500000 //MINIMUM LIQUIDITY REQUIREMENT
and HIGH > ref(close, -1) // LIMIT HIT BY TODAY'S HIGH BEING ABOVE YESTERDAY'S CLOSE
, parm2);


Do I also need to change OPEN here to ref(OPEN,1) and ref(close-1) to CLOSE to make sure that the statistics are being correctly calculated?

Kevin
Kevin_in_GA
 
Posts: 171
Joined: Wed Aug 04, 2010 10:14 am

Re: entry AND exit on day of signal

Postby Overload » Mon Feb 27, 2012 9:52 am

Yes, I was going to mention this, but wanted to get past the basic Entry and Exit Strings before working on the Custom Formulas. You do currently have a small forward-looking reference in that you are checking the volume after market close on the Trade Date. I doubt this will have much of an impact on your overall results, but you should probably be verifying the volume on the Signal Date rather than the Trade Date.

But whenever you use a ref(open, 1), it will not run in the Daily Signals since you don't have access to tomorrow's prices at the time the Signals are run. You'll need to be aware of that with your Entry String, but I'm sure you already are. Since one of your filters is that the opening price needs to gap below the prior day's close on the day you enter the trade, this will take some special intraday monitoring on your part when you're actually trading.

But... there's no reason your Custom Formulas need to have this issue. Rather than shifting the open to ref(open, 1), I would instead recommend shifting your volume test backward one day. Here is the code that I would use:


DAILYGAPDOWN - COUNT THE NUMBER OF GAPS X% BELOW YESTERDAY'S CLOSE OVER THE LAST Y DAYS

Code: Select all
parm1 = parameter("parm1");
parm2 = parameter("parm2");
DAILYGAPDOWN =
hadalert(
OPEN < ref(close, -1)* parm1 // OPEN AT LEAST X% BELOW YESTERDAY'S CLOSE
and ref(CLOSE, -1)*ref(MOV(VOLUME,30,SIMPLE), -1) > 500000 //MINIMUM LIQUIDITY REQUIREMENT
, parm2);


DAILYGAPFILL - THE NUMBER OF TIMES A SPECIFIC X% GAP OCCURRED AND WAS FILLED ON THE SAME DAY OVER THE LAST Y DAYS

Code: Select all
parm1 = parameter("parm1");
parm2 = parameter("parm2");
DAILYGAPFILL =
hadalert(
OPEN < ref(close, -1)*parm1 // TODAY'S OPEN AT LEAST X% BELOW YESTERDAY'S CLOSE
and ref(CLOSE, -1)*ref(MOV(VOLUME,30,SIMPLE), -1) > 500000 //MINIMUM LIQUIDITY REQUIREMENT
and HIGH > ref(close, -1) // LIMIT HIT BY TODAY'S HIGH BEING ABOVE YESTERDAY'S CLOSE
, parm2);


Again, I haven't tested this, but I'm pretty confident that this is what you want.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: entry AND exit on day of signal

Postby Overload » Mon Feb 27, 2012 10:04 am

I have found in almost all the trades,the trades and prices in SS were exactly as I calculated by hand.However,I did find specific instances where my hand calculated entry did not match the trade entry price in SS,i.e C*.98.

One example is AAPL on 2/22/2011
The close on 2/18 was 350.56. .98* 350.56=343.5488
On the trades report,SS has me entering at 342.15
No commisions or spread slippage.

There are other examples.Any thoughts?


Allan,

There is a limited amount of intraday processing that can be done when using EOD prices, but StrataSearch does as much as it logically can to reproduce the events and numbers that would actually have taken place. When using Limit Orders, one of the things StrataSearch will do is to enter the trade at the Open Price if the Open Price happens to be in Limit Order trigger territory. That is what would happen in real trading.

For AAPL on 2/22/2011, the Open Price of 342.15 was in Limit Order trigger territory, and that's why StrataSearch entered the trade at that price on that day.

Hopefully this helps.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: entry AND exit on day of signal

Postby taowave » Mon Feb 27, 2012 1:23 pm

I completely overlooked that the fill was at the opening price,which is exactly what one would hope.
Perfect!

Thanks,

Allan

Overload wrote:
I have found in almost all the trades,the trades and prices in SS were exactly as I calculated by hand.However,I did find specific instances where my hand calculated entry did not match the trade entry price in SS,i.e C*.98.

One example is AAPL on 2/22/2011
The close on 2/18 was 350.56. .98* 350.56=343.5488
On the trades report,SS has me entering at 342.15
No commisions or spread slippage.

There are other examples.Any thoughts?


Allan,

There is a limited amount of intraday processing that can be done when using EOD prices, but StrataSearch does as much as it logically can to reproduce the events and numbers that would actually have taken place. When using Limit Orders, one of the things StrataSearch will do is to enter the trade at the Open Price if the Open Price happens to be in Limit Order trigger territory. That is what would happen in real trading.

For AAPL on 2/22/2011, the Open Price of 342.15 was in Limit Order trigger territory, and that's why StrataSearch entered the trade at that price on that day.

Hopefully this helps.

Pete
taowave
 
Posts: 584
Joined: Sat Dec 02, 2006 12:39 pm

Re: entry AND exit on day of signal

Postby Jaded » Sun Aug 12, 2012 4:21 am

I have another question regarding GTCLimit and GTCStop.

For example, I have the following rule that I am testing against Forex:

Entry String:
1 = 1

Exit String:
GTCLimit(3,leveraged) or GTCStop(3,leveraged)

Entry Order:
Market, ref(open, 1)

Exit Order: (should never occur)
Market, ref(open, 1)

Do you see any pitfalls to this, using margin or 100% cash? I'm personally testing rules like this with margin and have some good results, but almost too good so I am thinking there could be something horribly wrong with using GTCLimit and GTCStop together in the exit string. Since we know the open and close prices for each day, we know whether the price went up or down from the buy price (market open), but I wanted to double check to make sure this is OK and has been verified to be accurate for both Stocks and Forex with/without margin.
Jaded
 
Posts: 151
Joined: Mon May 14, 2007 6:49 pm

Re: entry AND exit on day of signal

Postby Overload » Sun Aug 12, 2012 9:09 am

No, I don't believe that is a valid system using daily bars. From the Open Price, the intraday price could easily float up or down 3% and it would be impossible to know whether the Limit or Stop was hit first. That information isn't available in a daily price bar. I don't believe you can use a GTCLimit and a GTCStop at the same time using daily bars.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: entry AND exit on day of signal

Postby Jaded » Sun Aug 12, 2012 5:59 pm

Now that I slept on it and thought it through some more, I realize what was happening. It was producing a very favorable system and usually that is a sign of look-forward bias or an issue with the GTC formula's.

I'm going to switch my search to pick from 1 of GTCLimit OR GTCStop to see what gives me the best results after about 100,000 runs. It's really a shame that we can't use both and there is no other program out there that I have found easy to use like StrataSearch that deals with intraday data.

I'm up for suggestions, but basically I would want to test is rules that always include an intraday stop loss of 3% and an intraday take profit of 6% which isn't possible to do with daily bar data.
Jaded
 
Posts: 151
Joined: Mon May 14, 2007 6:49 pm

Previous

Return to Technical Support

cron