[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Array Loop simple question



PureBytes Links

Trading Reference Links



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



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___