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

Re: [amibroker] Re: ApplyStop question



PureBytes Links

Trading Reference Links




Tomasz:
 
I understand the code for a protective stop but its 
the running trailing stop that has me stumped. The following code probably won't 
work for a trailing stop using the previous days low (long 
position):
 
Amount = -(L-ref(L,-1)); // Amount should be 
positive???ApplyStop( stopTypeTrailing , stopModePoint, Amount, True, True 
);
 
What happens when "Amount" is 
negative?
 
Ted


<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Tomasz Janeczko 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, March 05, 2003 12:32 
  PM
  Subject: Re: [amibroker] Re: ApplyStop 
  question
  
  Ted,
   
  It is quite simple:
   
  ApplyStop( stopTypeLoss, stopModePoint, BuyPrice - Ref( Low, 
  -1 ), True );
   
  (this is for long only system if you want long and short 
  then it will look like this:)
   
  Amount = IIF( buy, BuyPrice - Ref( Low, -1 ), Ref( High, -1 
  ) - ShortPrice );
   
  ApplyStop( stopTypeLoss, stopModePoint, Amount, True 
  );
   
   
  Explanation:
  amount (distance) is measured in dollars from buyprice 
  (shortprice).
  So to exit at previous bar stop the amount would be the 
  difference between
  buyprice and prev day low.
  Best regards,Tomasz 
  Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Ted Chmilar 
    
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Wednesday, March 05, 2003 9:27 
    PM
    Subject: Re: [amibroker] Re: ApplyStop 
    question
    
    AV
     
    I would also be interested in someone posting a 
    solution to your problem. Perhaps TOMASZ??
     
    Ted
    
    <BLOCKQUOTE 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      Avcinci 
      
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Tuesday, March 04, 2003 6:10 
      PM
      Subject: Re: [amibroker] Re: 
      ApplyStop question
      
      Thank you, Thomas, but no, that's not correct for max stoploss 
      types of stops. ApplyStop uses the high for long trades when coding a 
      TRAILING stop. I was asking about a max stoploss. The latter uses the 
      entryprice as the price to key off of when exiting. Here is an excerpt 
      from the help file:
       
      
      ApplyStop( 
      stopTypeLoss, stopModePoint, 2 * ATR( 10 ), True );The function above 
      will place the stop 2 times 10 day ATR below entry 
      price.
      I'm still looking for the answer to my question about trying to exit at 
      the low of the day before the entry. Anyone have an idea? 
      AV
       
       
      <BLOCKQUOTE 
      >
        ----- Original Message ----- 
        <DIV 
        >From: 
        <A title=tchan95014@xxxxxxxxx 
        href="">tchan95014 
        <tchan95014@xxxxxxxxx> 
        To: <A 
        title=amibroker@xxxxxxxxxxxxxxx 
        href="">amibroker@xxxxxxxxxxxxxxx 
        
        Sent: Tuesday, March 04, 2003 4:11 
        PM
        Subject: [amibroker] Re: ApplyStop 
        question
        Hello,I think AB ApplyStop() function uses 
        HIGH for your long trades as the basis to calculate the stop price. 
        That is the stop price is the highest high ever reached during the 
        trade minus the AMOUNT you set as the stop price. It does NOT use 
        the buyprice as the basis, so it is NOT the LOW of the pre-entry day 
        price as you expected.ThomasSend 
        BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
        suggest@xxxxxxxxxxxxx-----------------------------------------Post 
        AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web 
        page: <A 
        href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
        group FAQ at: <A 
        href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
        Your use of Yahoo! Groups is subject to the <A 
        href="">Yahoo! Terms of 
        Service. Send BUG REPORTS to 
      bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
      suggest@xxxxxxxxxxxxx-----------------------------------------Post 
      AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
      <A 
      href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
      group FAQ at: <A 
      href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
      Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 
    SUGGESTIONS to 
    suggest@xxxxxxxxxxxxx-----------------------------------------Post 
    AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
    <A 
    href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
    group FAQ at: <A 
    href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT  









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.