newbie to R, less than a week, and I ordered some books about R, but I learn better by examples.. and thus far I cant find a good example of what I am trying to do... which follows:
assuming one is using any instrument intra-day data... I want to.. open a file (lets name it signal) that will contain two fields... date/time(MM/DD/YYYY HH:MM) and signal (1=buy,-1=sell) open a file with real time data for instrument (I cant find anything that will let me access intra-day online directly from someone like IQFeed or eSignal) the content of the file will look as follows: "Date","Time","Open","High","Low","Close","Volume" 05/16/2007,10:15,74.800,74.850,74.550,74.725,123 05/16/2007,10:16,74.700,74.700,74.600,74.625,33 05/16/2007,10:17,74.675,74.725,74.600,74.600,21 I would like to be able to determine the start and end of the period to test, and verify that signals exist within that period or assume the signals are 0... for no trades.. then I would like to basically process the signal file.. and at the time of the "signal" whenever I see -1 then sell instrument, if I see 1, then buy it... to determine the buy price, I would like to make sure the signal time coincides with the intraday data time.. and then either buy/sell the next minute open... then given a set of variables (target, stop) I would basically either sell at target or stop... the other thought is to buy/sell after X number of target/stop bars.. also, if an opposite signal is processed before target/stop are reached, the position would immediately reverse... the above assumes 1 minute bars for simplicity.... to view the results, I want to then chart the chart candles and the signals on the chart... with the P&L below the chart... assuming a starting portfolio of X size, where X is a variable set to 0.00... any assistance at all would be greatly appreciated... if you can, please document any code tidbits to assist with my learning process... thanks! -- View this message in context: http://r.789695.n4.nabble.com/newbie-question-strategy-tp4538818p4538818.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.