Hi All, I am new to R, and I am trying to backtest a simple strategy: I have a time series <- ts and a filter <- Filter. I want to check, if abs(ts-Filter)>parameter then get into trade (sell if ts-filter>parameter, buy if ts-filter< parameter) now that i am in a trade, i want to check what comes first, profit or stoploss, lets assume they are of the same size (profit) i.e. if I am in a sell position, if ts-sellprice>profit -> pnl += profit. if ts-sellprice < - profit -> pnl -= profit. after trade closes, continue with checking the ts for more traders etc... any help with how to program it will be very much appreciated. Thanks -- View this message in context: http://r.789695.n4.nabble.com/Backtesting-tp4662728.html Sent from the Rmetrics mailing list archive at Nabble.com.
Backtesting
1 message · alonbrag