PureBytes Links
Trading Reference Links
|
> {Short Stop Loss}
> ExitShort("SSL") at EntryPrice + 3*AvgTrueRange(ATRLen) Stop;
>
> The entry is ok (ie., all conditions met then enter tomorrow on
> open) but then the system exits at the open price on the same bar.
I suspect you issued the ExitShort order on the same bar where you
issued the Sell order. At the time that you did the ExitShort, you
didn't have a current position, so EntryPrice corresponded to the
entry price for the *previous* trade. If it was sufficiently below
your new trade, the entry price of the trade would trigger the exit.
The trick that Andy posted (using BarsSinceEntry) will help, since it
will prevent you from issuing the ExitShort until you're in a
position. Unfortunately that means you're "naked," without an entry
stop, on the first bar of the new position.
To get around that, you might want to use something like this:
if (your buy condition) then begin
sell tomorrow at market; { Sell tomorrow's open }
ExitShort at open tomorrow + 3*AvgTrueRange(ATRlen) stop;
if BarsSinceEntry > 0
then ExitShort("SSL") at EntryPrice + 3*AvgTrueRange(ATRLen) Stop;
I.e. explicitly use "open tomorrow" as your entry price to set the
stop on the bar before you enter the trade. Once you're in the
trade, you can use EntryPrice.
I didn't test it, but I think that will solve your problem.
Gary
|