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

[amibroker] Re: Simple code is not working,,,



PureBytes Links

Trading Reference Links

While Thomas's approach is better, (in case you need same type of 
comparison in the future) your original code would work if you have 
subsitituded "< -0.03" with "< 0.97" and "> 0.03" with ">1.03"

ie:
> Buy =  BuySignal < 0.97;
> Sell = SellSignal > 1.03;

Cheers
Umit 


--- In amibroker@xxxxxxxxxxxxxxx, "chugunok" <chugunok@xxx> wrote:
>
> Hi Folks,
> I am learning AFL, and tried to implement a simple strategy:
> Buy when price drops 3% below yesterday's close
> Sell when it is 3% above the purchase price
> 
> Here is the code:
> 
> BuySignal = ( Close - Ref(Close, -1) ) / Close;
> SellSignal = (Close-BuyPrice) / Close;
> Buy =  BuySignal < -0.03;
> Sell = SellSignal > 0.03;
> 
> When I run it in scan I only get Buy signals, no sell signals. I
> assume there is a problem with the logic, but I cannot see it...
> I would appreciate a helping hand :-)
> Thanks,                  Paul C.
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.26/598 - Release Date: 12/22/2006 3:22 PM