hi, I added an example where I use some constraints of my own. The buy and short constraint contain multiple signals. Have a look if you can figure it out. It is worth while to figure out how this works because you can add stops or any type of exit you like in these loops.
rgds, Ed ----- Original Message ----- From: chaoss45 To: [email protected] Sent: Wednesday, August 05, 2009 11:51 AM Subject: [amibroker] Re: remove all excessive signals Hi Ed, ok, thank you very much. I don't have the exact code here right now, but i can try to sum up a short version from memory. I don't know the exact applystop rules i used. And also don't know the Dhigh and the Dlow rules right now, but they describe a high and a low taken from a couple hours in the morning (Dutch). I hope you can show me the loop with this data, or else i will post the code later this evening. **************************************** timeopen = 070000; timeclose = 180000; tod = TimeNum(); inRange = tod >= timeopen AND tod <= timeclose; Dhigh = ....; DLow = ....; Buy = inRange AND Cross(High,Dhigh); Sell = 0; applystop(...); Short = inRange AND Cross(ShortStop,Dlow); Cover = 0; applystop(...); Buy = ExRem(Buy,tod==180000); Sell = ExRem(Sell,tod==180000); ********************************************** regards --- In [email protected], "Edward Pottasch" <empotta...@...> wrote: > > simplest way to do this is using loops. If you post your problem (buy, sell, short and cover array constraints) I can show you how, > > rgds, Ed > > > > > > ----- Original Message ----- > From: chaoss45 > To: [email protected] > Sent: Wednesday, August 05, 2009 10:28 AM > Subject: [amibroker] Re: remove all excessive signals > > > Hi Mike, thanks. > > I am talking about one symbol, just take the first signal that appears and remove all others. > Further i made a mistake in my previous postings, i said "Sell" but it should be "Short". > So for a recap: I want to take the first signal that appears (Buy or Short) and remove all other signals for that symbol for that day. > Right now i'm working with Exrem and got all excessive Buys and Shorts removed, but that still leaves me with 1 Buy and 1 Short signal a day. > > How can i remove this last excessive Buy or Short signal? > > Your idea should work, but i'm not a great coder so i hope there is a simpler way to do this. > > --- In [email protected], "Mike" <sfclimbers@> wrote: > > > > Sorry, > > > > I think that I misread your question. Though, the answer is laregely the same; you could use custom backtester. > > > > Iterate through the signals at each bar. If an open position already exists for the symbol, reset the position size to zero for the new signal if the date of the bar is the same as the entry date of the open position. > > > > Any attempt to use arrays outside of the custom backtester using such approaches as flip, exrem, etc. do not take into account that some signals simply will not get filled due to portfolio limitations. Thus, custom backtester is the only reliable way of knowing if a position was *actually* taken. > > > > Mike > > > > --- In [email protected], "Mike" <sfclimbers@> wrote: > > > > > > One sure fire way to do it would be to write custom backtester code that iterated through the trade signals at each bar and simply reset the position size to 0 for all remaining signals. > > > > > > Regardless of how you accomplish your task, if you are trading more than a single symbol you are at risk of getting highly biased results. How do you determine which signal occured first? If you get 3 Buys from 3 symbols on the same bar, which one do you take? Whatever logic you use to make that determination will bias your results. You would likely be best to select from the 3 at random. > > > > > > Mike > > > > > > --- In [email protected], "chaoss45" <chaoss45@> wrote: > > > > > > > > > > > > Hello all, > > > > > > > > I'm trying to write code for a breakout system. > > > > Right now i have my system working (demo) but i'm having trouble to > > > > remove all excessive signals. > > > > I want to take the first Buy or Sell signal of the day, and all other > > > > signals for the day removed. > > > > For example: if the first signal is a buy signal, all other buy and sell > > > > signals should be removed (or ignored) but i cannot do it. > > > > I tried Exrem and that is working fine only for removing the other buy > > > > or sell signals, but not for removing all the other buy and sell > > > > signals. > > > > I think it is something simple, but for some reason i do not see it. > > > > Could somebody help me with the code? > > > > > > > > > >
