PureBytes Links
Trading Reference Links
|
TradeStation can now execute strategy code on every tick if you turn on this option so that if you say:
Buy next bar at MyValue stop;
then this will be interpreted as:
Buy next tick at MyValue stop;
So you can easily have multiple trades within a bar if you want to.
And if you add some code to count seconds on your computer clock you can do things like running your strategy code on the first tick after each 10-second interval while using 5-minute bars.
Bob Fulks
At 08:21 AM 12/28/2008, Gary Fritz wrote:
>Stop/limit orders take effect on the next bar. E.g. if you place an order on bar X, it takes effect on bar X+1. You will only have exits on the entry bar X+1 if you place exit orders on bar X, at the same time you placed the entry order.
>
>So you need to make sure you don't place the exit order until you're already in the trade. You had the right idea here:
>
>> buy ("long") 10000/c shares value17 stop;
>> if (high >>= value17) then in=1;
>
>...but there's one problem with that: I don't see it in your sample, but I suspect you're recomputing value17 on each bar. So you place the order with value17 on bar X. Let's say on X+1 the price hits your entry. When you compare high >= value17, you're not using the value17 that you used for the original entry order, but the value17 you computed on bar X+1.
>
>I don't have a TS handy to test it, but you'd probably be better off to use MarketPosition or BarsSinceEntry to test whether you're in a position. Or maybe use if (high >= value17[1]) then in=1 to use the bar X value of value17 to test the high of bar X+1.
>
>Gary
>
>
>SC wrote:
>> Hello Philip,
>> Sorry I can't test that code for you at the moment my Tradestation
>> computer is having boot problems, from memory when I was testing that
>> exit with various entries I don't recall ever having an entry on the
>> same bar as the exit.
>> Probably my entries were not in the same range as the exits.
>> You could create two line indicators, one showing your entry values
>> and the other that shows your exit values, if the entry values are
>> below the exit values for a long trade TS will exit and buy right back
>> in on the same bar.
>> Best regards,
>> SC
>>
>> PL> Thanks SC,
>>
>> PL> But I don't think this does exactly what I need - or maybe I'm missing the
>> PL> point?. Trying to find a way to lock out additional trades within the bar,
>> PL> once the "intended" trade (an exit) has happened. You would think
>> PL> BarsSinceExit or something would do it. But apparently TS doesn't update
>> PL> BarsSinceExit and the like until the "end" of the bar, after the extra trade
>> PL> has already happened. Does the Ask. Mr. Easylanguage book cover this kind of
>> PL> stuff?
>>
>> PL> Best regards,
>> PL> Phil
>>
>> PL> ----- Original Message -----
>> PL> From: "SC" <secaseba@xxxxxxxxxx>
>> PL> To: "Philip Lane" <philtronics@xxxxxxxxxxx>
>> PL> Cc: <omega-list@xxxxxxxxxx>
>> PL> Sent: Friday, December 26, 2008 8:37 PM
>> PL> Subject: Re: old-school easylanguage question
>>
>>
>>
>>>> Hello Philip,
>>>> My version of the TS4 built in $Risk Stop
>>>> If MarketPosition(0)=1 then ExitLong at MaxPositionProfit(0)-stp limit;
>>>> If MarketPosition(0)=-1 then ExitShort at MaxPositionProfit(0)+stp stop;
>>>>
>>>> You should be able to add your AvgTrueRange calc. into the stp amount.
>>>> Best regards
>>>> SC
>>>>
>>>> PL> How to prevent a round trip on a stops on a daily bar? I can't
>>>> remember the
>>>> PL> trick. Barssinceentry doesn't do it.
>>>> PL> Here's a picture and some code:
>>>> PL> http://www.gigascanner.com/002.gif
>>>> PL> {if (in=0 or in=-1) then begin}
>>>> PL> buy ("long") 10000/c shares value17 stop;
>>>> if (high >>= value17) then in=1;
>>>> PL> if (in=1 and barssinceentry>1) then exitlong
>>>> PL> value17/(1+factor*AvgTrueRange(5)/100) stop;
>>>> PL> if (low <= value17/(1+factor*AvgTrueRange(5)/100) and
>>>> barssinceentry>-1)
>>>> PL> then in = 0;
>>>> PL> Thank you,
>>>> PL> Phil
>>>>
>>>>
>>
>>
>>
>
|