Quote from 2rosy:
this is what I was referring to with a list of bars
Code:class BarList(object): def __init__ (self,barsecs,runningtime): totlap=86400.0 self.barsecs = barsecs self.totcount = totlap / barsecs self.bars = [ Bar() for i in self.totcount ] def newTick (self,tick): runningtime = tick.timestamp self.bucket = runningtime / barsecs
Quote from tiagor:
Progress report: Still trying to weed out some bugs in the simulator. I actually found a nasty one on the way the stop-loss and drawdown were being calculated (they were based on the close value of a data sample and not accounting for the full price range). These are being fixed now.
I've also started to build my first ghost. The real headaches are about to begin.![]()
Quote from Random.Capital:
Why?
Markets don't trade on constant-time, why the urge to bucket into constant-time buckets?
void tick()
{
while (true)
{
Quote q = theQueue.peek();
if (currentTime() - q.time() <= tenMinutes) break;
theQueue.pop();
}
}
Quote from hft_boy:
If you really insist on having all the quotes from the last 10 minutes, though, just stuff the quotes into some sort of FIFO queue (in C++ this could be std::queue, std::list or std::deque). Every time you get a tick, examine and pop all the quotes which are older than ten minutes.
As above, use a List or similar. Put the ticks into the list over the 10 mins, then when the first 10 mins expires, calc the average. From there on, re-calc the average every second or whatever, while the list is still being populated with new ticks, and, discard the ticks that are now older than 10 mins ... thus maintaining the window. *you may need to get familiar with locking for this to not crash.Quote from vincegata:
...For example, I want to generate the signals based on the past 10 minutes SMA, which is 600 seconds. So I allocate a buffer of 600 doubles which will hold 10 min worth of bars.
... However, my buffer of 600 will hold the quotes for more or less than 10 min because the quotes come sometimes faster and sometimes slower...
Quote from Rationalize:
As above, use a List or similar. Put the ticks into the list over the 10 mins, then when the first 10 mins expires, calc the average. From there on, re-calc the average every second or whatever, while the list is still being populated with new ticks, and, discard the ticks that are now older than 10 mins ... thus maintaining the window. *you may need to get familiar with locking for this to not crash.
That being said, I don't think there is any efficacy in using a 10 min sma for really anything at all. Sorry to be a dick ..
No MAs at all really. Occasionally a vwap over the day, but nothing where each trade is assigned the same weight. Scoring all trades with the same weight would imply that everyone knows what they are doing & all trades are equally informed. This is, in my view, ridiculously fanciful.Quote from vincegata:
I got it about the "window" concept. THX to you and previous posters too.
You do not use any of MA for your strategies? Or it's 10 min SMA that troubles you, I just used 10 min as an example.
Quote from vincegata:
You do not use any of MA for your strategies? Or it's 10 min SMA that troubles you, I just used 10 min as an example.