Hi, take a look at the following code, it generates only a
buy if the previous high + 1% will be reached and it will be closed when the
low reaches the previous low -1% What condition do you use ? BuyStop = Ref(H,-1)*1.01; //the formula for Buy
stop level; SellStop = Ref(L,-1)*0.99; //the formula for Sell stop level; // if anytime during the day prices rise above buystop level
(high>buystop) // the buy order takes place (at buystop or low whichever is
higher) Buy = Cross( High,
BuyStop ) ; // if anytime during the day prices fall below sellprice level (
low < sellstop ) // the sell order takes place (at sellstop or high whichever is
lower) Sell = Cross( SellPrice,
SellStop); BuyPrice = Max( BuyStop, Low ); // make sure buy price not less than Low SellPrice = Min(
SellStop, High ); // make
sure sell price not greater than High Thomas -----Original Message----- I understand how the logic of the buystop works as currently structured. If the buystop price is not exceeded during the day (High not
greaterthan buystop) than the backtester will give me the Low of the day as my
filled price. I have tried any number of logic combinations and can not achieve the following. If the high of the day is not greater than buystop than I want NO
trade to occur. For the life of me, I can not achieve a logic combination that cancels the buy if this occurs. I can set the price filled to be the
days open, high, low or close, but I can not cancel the buy. Any coding help would be greatly appreciated. Ed -----Original Message----- From: Of zoli_j Sent: Wednesday, October 11, 2006 2:14 AM To: Subject: [amibroker] Re: Buy At Stop, Short At Stop Thank U Thomas!!! --- In > > Hi, > > Yes, you can do it easily: > > BuyStop = ... the formula for buy stop level; SellStop = ... the > formula for sell stop level; > > // if anytime during the day prices rise above buystop level (high>buystop) > // the buy order takes place (at buystop or low whichever is
higher) > Buy = Cross( High, BuyStop ); > > // if anytime during the day prices fall below sellprice level ( low < > sellstop ) > // the sell order takes place (at sellstop or high whichever is lower) > Sell = Cross( SellPrice, SellStop); > > BuyPrice = max( BuyStop, Low ); // make sure buy price not less than Low > SellPrice = min( SellStop, High ); // make sure sell price not greater than > High > > Thomas > > www.tradingbasis.com <http://www.tradingbasis.com/> > > > > > > _____ > > From: On Behalf > Of zoli_j > Sent: Tuesday, October 10, 2006 5:49 PM > To: > Subject: [amibroker] Buy At Stop, Short At Stop > > > > Hallo Group, > > Is it possible to entry with stop into a trade? > If yes then could U show me an AFL example for it? > > BR Zoli. > 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 -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.2/471 - Release Date:
10/10/2006 -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.2/472 - Release Date:
10/11/2006 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/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/amibroker/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ 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
SPONSORED LINKS
Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___ |
- RE: [amibroker] Re: Buy At Stop, Short At Stop Thomas Z.