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

Re: [amibroker] counting setups and conditioning the buy on that count



PureBytes Links

Trading Reference Links

Oops.  Nevermind.  I found the error, and I got it to work now.  For
one thing, I had not written a Foreign() name in the buy statement.
But it seems to work now.  Thanks!

Yuki

YT> Hi Ara,

YT> I cannot get this to make a trade.

YT> Here is what I have:

YT> Numerous variable declarations here ... then ...

YT> TestMode = 2; //TestMode 1 writes the ATCs

YT> // I just toggle to 1, then scan, and then toggle back to 2, and
YT> // then backtest

YT> if  (TestMode==2)
YT> {
YT> Setups = Foreign("~compSetups", "Close", fixup = 1);  // read ATC file to see if you should trade
YT> }

YT> Here, I declare Setups as a variable, conditions which are also part of the buy
YT> statement of course ...

YT> if  (TestMode==1)
YT> {
YT> Setups = AddToComposite(Setups, "~compSetups", "Close", flags = atcFlagDefaults);
YT> }
YT> else
YT> {

YT> Buy = My normal rules AND TestMode == 2 AND Setups >= defined by me
YT> on the fly;

YT> Sell = 0;
YT> }

YT> I use an apply stop as an exit ...

YT> It *does* create a ~compSetups ticker, and the values look right.  But
YT> I cannot get it to trade now.

YT> Yuki

YT> Monday, January 30, 2006, 3:59:17 PM, you wrote:

YT> AK> I understand that you want to see how many stocks give you a setup on any
YT> AK> given day. If you have a greater number of setups then a predetemined value,
YT> AK> then you trade.

YT> AK> Looks like you need to do 2 passes.
YT> AK> 1. First pass to count the number of setups and store them in an ATC file,
YT> AK> instead of trading.
YT> AK> 2. Modify your code so it reads the ATC file you just wrote and then process
YT> AK> your normal trade conditions.

YT> AK> You can accomplish this by either modifying a couple of lines of code to
YT> AK> change the operation or use a parameter to do the switching.

YT> AK> TestMode = Param("TestMode",1,1,2,1);  //TestMode 1 writes the ATCs

YT> AK> if  (TestMode==2)
YT> AK> {
YT> AK> Setups = Foreign(~ATC ... )  // read ATC file to determine if you should
YT> AK> trade
YT> AK> }


YT> AK> Test code
YT> AK> ....
YT> AK> ...

YT> AK> if  (TestMode==1)
YT> AK> {
YT> AK> Setups = AddToComposite(...
YT> AK> }
YT> AK> else
YT> AK> {
YT> AK> Buy = ... your "normal" criteria and TestMode == 2 and Setups >= you
YT> AK> criteria for setups
YT> AK> Sell = ...
YT> AK> }







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

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

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

 
YT> Yahoo! Groups Links



 






 
Best,

Yuki



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

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