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

RE: [amibroker] Assigning a # Value to multpile buy and sell criteria



PureBytes Links

Trading Reference Links

Your first statement actually returns True or False (1 or 0) with no
other help needed. However, you are checking today's close against the
close 15 bars ago. I'm not sure this is what you want.

Adding True/False statements together is valid. Depending on what you
want you might consider using OR instead of AND as AND requires BOTH
statements to be True to execute.

Simplified example (which does not solve your problem by the way):

myCondition = Close > Ref(Close, -15) OR Close < Ref(Close, -15);

//myCondition will be True if EITHER condition is True. AND would never
be true here since both conditions cannot be True simultaneously.

Now to know if you have changed 5 points you need to "remember" or
lookup the value of Close at the time of the BUY or whatever your
trigger point is, such as:

refClose = ValueWhen(Buy,Close,1);

Then your condition will become:

pointMove = Param("How many points",5,0,20,1); //Adjustable points
myCondition = C > refClose + pointMove OR C < refClose - pointMove;
--
Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of christophermuch
Sent: Monday, July 24, 2006 14:48
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Assigning a # Value to multpile buy and sell
criteria

Im trying to develop a indicator that buys and/or sells when a 
certain number of points is reached(5 for example).  I know this is 
a very basic question, but I have tried everything I could think of 
(of which I'm sure you'll see with one glance at the code below).  

In the following, I was trying to assign a numerical value of 1 to 
the statement if it was infact true.

C1 = Close > Ref(Close, -15);
IIf(C1, 1, 0);
ResultC1 = WriteIf(C1, "1", "0");

In this case, I was trying to assign a numerical value of -1 to the 
statement if it were in fact true.

C2 = Close < Ref(Close, -15);
IIf( C2, 1, 0);
ResultC2 = WriteIf(C2, "-1", "0");


The idea being that if multiple criteria added up to a certain + or -
 value I would indicate a buy or sell.

I am very greatful to the members of this board for spending the 
time to help me.  

Regards, 

Chris






Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links