Thank you Keith, and from now i will be adding prevoius posts to mains I'll check your hint and let you know about results ;]
--- In [email protected], Keith McCombs <kmcco...@...> wrote: > > Raskoks -- > First of all, please add your response to a post above what you are > responding to. Otherwise, the reader most hunt back through previous > threads, to make any sense out of it. I'm adding what I said the first > time, just so that it will make sense to me. > > To do what you want to do, at least as I understand it, all you need is > this: > Buy= C1 AND CondBuy; > Sell=C2 AND CondShort; > // then ExRem prevents additional buys before sell > // and additional sells before buy > Buy = ExRem(Buy, Sell); > Sell = ExRem(Sell, Buy); > > Then decide if you want to allow your strategy to sell on same bar as > buy, and check or uncheck AA>Settings>General>"Allow same bar exit" > accordingly. > > No looping is needed. > > -- Keith > > --- previous response from raskoks ---- broken thread ------ > Keith thank you - you are right about it should be > B= (bsB>bsS); > S= (bsB<=bsS); > > But how to start these arrays. I mean that it impossible to count B and > S without previous byy and sell. So i need something like 'fake' first > buy and sell. > But how ? B[0]=true , S[0]=false ?? > > -- > regards > raskoks > > Keith McCombs wrote: > > Raskoks -- > > Assuming that C1, C2, CondBuy, and CondShort, are arrays and not a > > function of your buying history, > > You might have two problems (or maybe just one): > > 1. You may, or may not, need to use looping if you wish to make buy > > sell decisions based on previous buys and sells. > > 2. More importantly, I do not think that you have thought through what > > you mean by: > > B= (bsB<bsS); > > S= (bsB>=bsS); > > because, if you want to buy before you sell and sell before you buy, > > you are not pyramiding, and you do not want to buy and sell on the > > same bar, or vise-versa, then: > > once you are long, then bsB *is* less than bsS and therefore B would > > be true (and S false). And > > once you have sold, then bsB *is* more than bsS and therefore S > > would be false (and B true). > > > > Once you straighten out 2. above, you might even discover that you > > don't need looping after all. > > > > -- Keith > > > > raskoks wrote: > >> > >> > >> Hi, I've got problem with looping of my arrays ;-) > >> Let's look: > >> > >> Buy= C1 AND CondBuy AND Ref(B,-1) > >> Sell=C2 AND CondShort AND Ref(S,-1) > >> > >> bsB=BarsSince(Buy); > >> bsS=BarsSince(Sell); > >> B= (bsB<bsS); > >> S= (bsB>=bsS); > >> > >> But i need B and S before Buy and Sell. How to start the array ? > >> Probably this is not a smart question - bu I stick on it. > >> > >> -- > >> Best regards > >> raskoks > >> > >> >
