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

RE: [amibroker] Re: Buy At Stop, Short At Stop



PureBytes Links

Trading Reference Links

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

www.tradingbasis.com <http://www.tradingbasis.com/> 

 

 

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of EF
Sent: Thursday, October 12, 2006 4:50 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: RE: [amibroker] Re: Buy At Stop, Short At Stop

 

 

  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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf

Of zoli_j

Sent: Wednesday, October 11, 2006 2:14 AM

To: amibroker@xxxxxxxxxxxxxxx

Subject: [amibroker] Re: Buy At Stop, Short At Stop

 

Thank U Thomas!!!

 

--- In amibroker@xxxxxxxxxxxxxxx, "Thomas Z." <tzg@xxx> wrote:

> 

> 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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]

On Behalf

> Of zoli_j

> Sent: Tuesday, October 10, 2006 5:49 PM

> To: amibroker@xxxxxxxxxxxxxxx

> 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

 

    http://groups.yahoo.com/group/amibroker/

 

    Individual Email | Traditional

 

    http://groups.yahoo.com/group/amibroker/join

    (Yahoo! ID required)

 

    mailto:amibroker-digest@xxxxxxxxxxxxxxx 

    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

 

    amibroker-unsubscribe@xxxxxxxxxxxxxxx

 

    http://docs.yahoo.com/info/terms/