Register Login
Forums    February 9, 2012
TradersStudio Forums
Stop loss
Last Post 03-10-2007 04:58 PM by Richard Denning. 2 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Deane Kebblewhite
New Member
New Member
Posts:12

--
02-21-2007 08:01 AM
    what would be the correct code for putting in a stop loss in a dollar amount or number of tics?  say for 5,000 dollars or 10 tics.   And would it differ between commodities and stocks?
    Deane Kebblewhite
    New Member
    New Member
    Posts:12

    --
    02-23-2007 05:11 AM
    Just to further my question on stop losses. I tried the following code testing on S&P daily sample data

    If tradestoday()=0 Then
    Buy("buyRange",1,Lo,Limit,Day)
    EndIf

    Exitdollarstop(1000,"","",1)

    ExitEOD("","",1)

    All the trades exit at end of day, however the biggest loss is 17,000 dollars.
    Richard Denning
    New Member
    New Member
    Posts:12

    --
    03-10-2007 04:58 PM
    Sub testDollarStop() If tradestoday()=0 Then Buy("buyRange",1,LowD,Limit,Day) EndIf ExitDollarStop(1000,"DollarStop","buyRange",1) ExitEOD("EOD","buyRange",1) End sub The code above (note modifications) works and does stop out at $1000 when tested on the 5 minute bar data. When creating the session be sure to set the data compression to 5 minute. It is easy to miss this step as the default is daily and then the code doesn't work as expeceted.
    You are not authorized to post a reply.


     TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved   Terms Of Use  Privacy Statement