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

Re: Help with coding an initial stop loss



PureBytes Links

Trading Reference Links

>I've found that some code works much better by not even allowing it to
>look at the data before a certain amount of time has passed after the
>open and closing out your trades before the session close can also
>change things.  That and turning the code off and back on again at other
>times can also change the results.

This is just a general comment, not a comment about Larry's code as I
don't know what he's trying to do. 

One of the frustrating things for many people is seeing trades happen
realtime and then restarting TS only to see that the trades have
changed. From my personal experience, this is always due to a coding
error and/or an incorrect understanding of how TS works. A simple
example might be several trades (or possible trades) happening on the
same bar which TS has trouble reconstructing properly when you restart
it. It doesn't know which condition happened first in the bar. The easy
answer there is shorter bars and coding changes so you only get one
trade on a bar. You can also tell it to look down to the tick level on
historical trades so it knows the order of the ticks. 

Another example might be global vars, as Bob mentioned, where they pass
values in the correct order realtime but muck it up if you restart. My
answer to that is to avoid global vars if at all possible. I don't use
them in any of my own stuff. I like the code in the system to be totally
self contained with all the data on one chart and only one possible way
the code can run. You can't go wrong treating EL as a very retarded
child and writing the code so there is no possible way you can be
misunderstood.

A sign of good TS code is that the realtime trades exactly match the
historical trades. You can restart your computer and all the buy/sell
arrows are in the same places and the report of the old trades is
identical to what it reported realtime. If your code can't do that, it
still needs some work. Hey, nobody said this was easy..... :-)

-- 
  Dennis