PureBytes Links
Trading Reference Links
|
Mike Gossland <gossland@xxxxxxxxxx> wrote :
>>> I would like to test this exit strategy (and others) during live intraday
>>> trading. A question: How can I tell a TS System that I entered a position
>>> Long at $105.00 at 2:14PM, so the System would indicate the actual position
>>> entry on the chart, then apply and plot the exit strategy from that point
>>> forward on the chart?
>>
>>input: ent_date(981102), ent_time(1414), buy_sell("buy");
>>
>>if date = ent_date and time = ent_time then begin
>> if buy_sell = "buy" then buy else
>> if buy_sell = "sell" then sell;
>>end;
>>
>>--
>> Dennis
>
>
>This kind of thing is one of the troubles with TS that causes people to look elsewhere for >trading software.
>
>You'd think it should be easy to say I bought at a particular time at a particular price. >Well, guess what - it isn't.
>
>With great respect to Dennis, the code above only partially addresses the problem. First of >all, you'd have to be running on a 1 minute chart to get the time of 1414 to match any >bar's time and generate the signal. Second, there's no provision for specifying price, >since the buy and sell signals will act on the close of that bar. You'll get whatever price >the close is, rather than the desired $105.00. Perhaps it's a small error, but on bigger >bars, it can be a real pain.
>
>Mike Gossland
>
Mike is right that it is difficult to input a price and get that exact
price on the system tracking log. I sometimes have to shorten the bar
time when I get a tall bar in order to find a price close to the one I
buy. Below is the code for a force-buy system I have been using which
allows up to 4 separate entries. It requires the price AND the time
for each entry. The time does not need to be exact, but the actual
rpice posted may vary. There are stop inputs for Loss and Trailing stops
(I never liked the TS stops). Try it.
don
---------
{ System : ForceBuy x4 w/stop }
input : MaxLoss(2),TrailStp(3),Stop_$(0),
Buy1Pric(0), Buy1Date(980), Buy1Time(0),
Buy2Pric(0), Buy2Date(980), Buy2Time(0),
Buy3Pric(0), Buy3Date(980), Buy3Time(0),
Buy4Pric(0), Buy4Date(980), Buy4Time(0) ;
Variables : Gain(0), TradeHi(0), TradeGain(0), Once(0) ;
IF Close > TradeHi Then TradeHi = Close ;
TradeGain = TradeHi - EntryPrice ;
IF Buy1Pric >= Low AND Buy1Pric <= High
AND Date = Buy1Date AND CurrentEntries = 0
AND ( Time >= Buy1Time OR Buy1Time = 0 )
Then BEGIN
BUY ("Buy1") This Bar ; TradeHi = Close ; Once = 1;
End ;
IF Buy2Pric >= Low AND Buy2Pric <= High
AND Date = Buy2Date AND CurrentEntries = 1
AND ( Time >= Buy2Time OR Buy2Time = 0 )
Then BEGIN
BUY ("Buy2") This Bar ; TradeHi = Close ; Once = 1;
End ;
IF Buy3Pric >= Low AND Buy3Pric <= High
AND Date = Buy3Date AND CurrentEntries = 2
AND ( Time >= Buy3Time OR Buy3Time = 0 )
Then BEGIN
BUY ("Buy3") This Bar ; TradeHi = Close ; Once = 1;
End ;
IF Buy4Pric >= Low AND Buy4Pric <= High
AND Date = Buy4Date AND CurrentEntries = 3
AND ( Time >= Buy4Time OR Buy4Time = 0 )
Then BEGIN
BUY ("Buy4") This Bar ; TradeHi = Close ; Once = 1;
End ;
IF MarketPosition = 1
AND ( Close <= EntryPrice - MaxLoss OR Stop_$ > 0 AND C < Stop_$ )
Then EXITLONG ("Loss") This Bar ;
IF MarketPosition = 1 AND TradeGain >= 1
AND ( Close < TradeHi - TrailStp OR Stop_$ > 0 AND C <
Stop_$ )
Then EXITLONG ("TrailStop") This Bar ;
=====================================================
|