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

[amibroker] Not selling at correct time?



PureBytes Links

Trading Reference Links

Sorry just tidied up the code below;


This is tetsing a couple of the code ruels and it is not producing what is
expected. Could someone see where I am going wrong on this? Code should find
the lowest low within last 60 days, the highest high since that date, the
lowest low since the high and enter on a break of the highest high value.
Some signals are correct but on others it is signalling a buy before the
break of the high

n = 60; //prior days period
search_factor = 20;

DaysML = Ref(LLVBars(L, n), -1); //finds the number of bars since the lowest
low within last 60 days
DaysMH = Ref(HHVBars(H, DaysML), -1); //finds the number of bars since the
highest high since the lowest low
DaysFL = Ref(LLVBars(L, DaysMH), -1); //finds the number of bars since the
lowest low since the highest high

PML = ValueWhen(LLVBars(L, Ref(n, -1)), L, 1); // finds the value of the low
price on day of lowest low
PMH = ValueWhen(HHVBars(H, Ref(DaysML, -1)), H, 1); // finds the value of
the high price on day of highest high
PFL = ValueWhen(LLVBars(L, Ref(DaysMH, -1)), L, 1); // finds the value of
the low price on day of last lowest low

Cond1 = DaysML > DaysMH > DaysFL; //sets date order of the low, high and
next low
Cond2 = (DaysML - DaysMH) > 10 AND (DaysML - DaysMH) < 30; //highest high is
at leas t10 days after lowest low
Cond3 = (DaysMH - DaysFL) > (0.5 * (DaysML - DaysMH)) AND (DaysMH - DaysFL)
< search_factor * (DaysML - DaysMH);

Cond10 = H > PMH;

Buy = Cond1 AND Cond2 AND cond3 AND Cond10;
BuyPrice = C;
Sell = BarsSince (Buy==2);
SellPrice = C;

Cond10 = ExRem(Cond10, Sell);




Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/