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

RE: [amibroker] Re: Why doesn't this work



PureBytes Links

Trading Reference Links




<SPAN 
class=890323012-29112003>Sorry, I'm not trying any of this, which probably means 
I'm wrong... It seems to me that if Gary's right about needing to use LastValue 
on the stopType ApplyStop parameter, that says it can't change over time. Check 
out the help for LastValue. You'll see that it returns the single last value in 
an array, so your stop is always one type or the other; it doesn't change 
dynamically. 
<SPAN 
class=890323012-29112003> 
<SPAN 
class=890323012-29112003>If I'm right about that, you'd need two different 
stops, one a stop loss and one a trailing stop, whose parameters you'd 
change to make one effectively the active one.
<SPAN 
class=890323012-29112003> 
<SPAN 
class=890323012-29112003>Dave
<BLOCKQUOTE 
>I 
  changed the volitility parameter to "True." But when I do an exploration I 
  see the same thing ... when the price drops below 30 pips of profit it 
  reverts to the 50 pip stop loss (within a single trade). 
  James--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" 
  <dmerrill@xxxx> wrote:> check your parameters for ApplyStop! 
  look at Volatile (this is straight out> of the help; put your 
  cursor somewhere within the word ApplyStop and press> F1 to see 
  it):> > ApplyStop( type, mode, amount, exitatstop, volatile = 
  False )> volatile -> decides if amount (or distance) (3rd 
  parameter) is sampled at the trade> entry and remains fixed during 
  the trade (Volatile = FALSE - old behaviour)> or if can vary during 
  the trade (Volatile = TRUE) (allows single line> Chandelier exit 
  implementation)> > dave> >   Getting 
  closer and closer ...> >   Gary: I used the lastvalue 
  function as you suggested and it>   eliminated the "bad 
  argument" error. Thanks!> >   Dave: You were right 
  that I wasn't using "Buyprice" correctly. I was>   able 
  to get what I wanted by making a new variable 
  "priceatbuy.">   Thanks!> >   And I 
  tweaked a couple of other things. But now I have another>   
  problem I'm trying to work through. To restate what I'm trying 
  to>   do ... I want a 50 pip stoploss, but once I have 30 
  pips of>   profit I want to switch to a 20 pip trailing stop. 
  Here is the code>   in it's current state:> 
  >   Buy = 
  Cross(EMA(Close,12),EMA(Close,26));>   Short = 
  Cross(EMA(Close,26),EMA(Close,12));>   Sell = 
  Short;>   Cover = Buy;>   
  PositionSize=100000;>   
  priceatbuy=ValueWhen(Buy,BuyPrice,1);>   
  Var1=IIf(High>=(priceatbuy+0.003),2,0);>   
  Var2=IIf(High>=(priceatbuy+0.003),0.002,0.005);>   
  ApplyStop(LastValue(Var1),2,Var2,True,False);> >   My 
  problem is that the trailing stop doesn't stick. If the 
  profit>   for a trade goes back below 30 pips it reverts to 
  the 50 pip stop>   loss. What I want to backtest is that the 
  trailing stop (once>   triggered) remains throughout that 
  particular trade. Then the next>   trade starts with the 
  50 pip simple stop loss. Any ideas?> >   All help is 
  truly appreciated!> >   
James






Yahoo! Groups Sponsor












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.