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

Re: [amibroker] Help with Exploration please



PureBytes Links

Trading Reference Links

Chrisb,

I made some notes in your code below attempting to fix your problems.

Instead of all that, how about trying ApplyStop after N bars and optimize on
N bars? (bars = days on daily data) It won't display percentages exactly,
but it will tell you which number of days makes more money, has lower
drawdowns, etc. Check help on Optimize and ApplyStop for parameter usage.

stopdays = Optimize("Stopdays",5,5,20,5); //Test exits at 5, 10, 15, 20 days
ApplyStop(stopTypeNBar,stopModePoint,stopdays,0,False,5);
//Exit at above periods. Do not re-enter same stock for 5 days.

Put the code after your Buy/Sell conditions.

Terry
--

> Greetings All.
> 
> Here is what I want to do:
> 
> 
> Test buy signals only, to see what percentage of the time the price is up
> after 5 days, 10 days, 20 days etc.
> 
> I want to set a buy condition, for example, a simple crossover,
> Then create an exploration for
> 
> a)     date of buy signal ( first line works)
> b)     Value of Open on the next day.(this line gives close of signal day: how
> to get open of the next day?)
> c)     Date for 10 periods from entry. (how to code for this?)
> d)     Close value on day 10 after entry.( I am totally lost here).
> 
> 
> Using code from the help file and yahoo groups. So far I have:
> 
> F1 = Cross(EMA(C,10), EMA(C,30));
> 
> Lastbar = BarIndex()==BarCount-1;//what does this mean in english?
Sets variable Lastbar to True when the current day is equivalent to the last
day of data. This accomplishes nothing in Explore as it is only true on the
last day of data in your database.
> 
> Condition = F1;
> Condition = ExRem(Condition,Lastbar);
Because Lastbar is only true for today, this is doing anything either
> 
> Filter = Condition;
> 
> Buy = F1;
> Sell = 0;
> 
> 
> 
> AddColumn(ValueWhen(F1,DateTime()),"ema Xover",formatDateTime);
> AddColumn(ValueWhen(F1,C), "Open next day",1.2);
You need to use the Open here...(F1,O) instead of (F1,C)

> //AddColumn( BarIndex(5), "date of buy plus 5 days",formatDateTime);
> AddColumn(ValueWhen( F1,C, 5),"C @ B +5", 1.2);//returns blank column
I'm not sure ValueWhen is valid for AddColumn. You can compute gains in your
code and just display them here...or use my first suggestion.
> //AddColumn( ?, "per change from buy",
> 
> 
> 
> Help or references appreciated
> 
> TIA
> 
> Chrisb



------------------------ 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/