Mike, Maybe I just do not know how to implement your code, but I do not understand what to do with it.
If you just had a simple MA Crossover script like: Buy = Cross(FastMA, SlowMA); Sell = Cross(SlowMA, FastMA); How would you implement your code into this? Thank you for your patience. --- In [email protected], "Mike" <sfclimb...@...> wrote: > > Weekly: > > weekDays = DayOfWeek(); > newWeek = weekDays < Ref(weekDays, -1); > > Monthly: > > months = Month(); > newMonth = months != Ref(months, -1); > > Mike > > --- In [email protected], "readshark" <readshark@> wrote: > > > > I am looking to add some code to one of my trading systems to limit the > > number of trades to x amount per week. > > > > I found a code that here that would limit the trades to one per day. Any > > idea how I alter this to only get one trade on a longer time frame, > > preferably a week? > > > > Thank you in advance. > > > > Here is the link and the code I found. -> > > http://www.mail-archive.com/[email protected]/msg23006.html > > > > for (i = 0; i < BarCount; i++) > > { > > if (newDay[i]) > > hadTradeToday = False; > > for (sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i)) > > { > > if (sig.IsEntry() && sig.IsLong()) > > { > > if (hadTradeToday) > > sig.PosSize = 0; > > else > > hadTradeToday = True; > > } > > } > > bo.ProcessTradeSignals(i); > > } > > >
