Profile Picture

question on days since last trade and trade count in simulation

Posted By adiaco 5 Years Ago

question on days since last trade and trade count in simulation

Message
Posted Tuesday January 24 2012
First, I'd like to thank everyone for there help on this forum. 

Is there a simple command to count the number of bars it has been since the last trade was made?  Also, is there storage of the number of trades that have been done in a simulation that I can access easily.  I need this because my first trade is a special case that I want to isolate from the others.  Alternatively, is there a way to test whether ClosedPositions exists yet?  (On the first trade, there will have been no closed positions yet)

Posted Tuesday January 24 2012
ClosedPositions should always exist. It is a list- if there aren't any closed positions then the Count will be zero, so you can check that.

Note that the word "trade" seems to be used in different ways. In RightEdge it means a single fill for an order. Some people seem to use it to refer to an entire position, from entry to exit. So depending on what you mean by "trade", you would calculate the most recent trade or number of trades differently.

There's no existing functionality to tell you when the last trade was made. You can look at the Trades property of the open positions and the last closed position to find the date/time of the last trade, and then look back through the bars to figure out how many bars ago that was. Or (and this is probably simpler), you can just keep a counter which you add to each time you get a new bar, and reset to zero each time you get a filled trade.

Thanks,
Daniel
Posted Wednesday January 25 2012
Great.  All working.  Thanks again.  Probably have more questions soon lol


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems