[R] newbie question: strategy

sysot1t sysot1t at gmail.com
Sat Apr 7 05:19:02 CEST 2012

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:


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

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... 


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.

More information about the R-help mailing list