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

Conditionnal stops (RE: [amibroker] trailing stop question from new user)



PureBytes Links

Trading Reference Links




<FONT face=Arial color=#0000ff 
size=2>Hello,
<FONT face=Arial color=#0000ff 
size=2> 
I 
don't think it is possible right now. The only way I can imagine would be 
through the Equity(1) function, but even that doesn't work properly. In fact, 
the Equity(1) function writes down the stops to the "sell/cover" 
variables, but doing so, new buy/short signals can be generated after the first 
stop that can modify the following positions. You should iterate the whole 
formula the same number of times as there are stop signals. I think it 
would be possible through a "WHILE" loop, but it doesn't seem a very sound 
process.
<FONT face=Arial color=#0000ff 
size=2> 
A 
better solution would be to have a "condition" parameter in the "ApplyStop" 
function, related to the state (in terms of profit and number of bars since 
opening) of the current opened position. Something like 
: 
 
<FONT face=Arial color=#0000ff 
size=2>"ApplyStop(type,mode,amount,condition,ExitAtStop,Volatile)"
<FONT face=Arial color=#0000ff 
size=2> 
A 
concrete example :
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>"ApplyStop(StopTypeLoss, StopModePoint,5,"Profit > 10 and Nbars 
> 5",true,true);"
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>"Profit" and "Nbars" could be something like "internal variables" and you 
could imagine to be able to decide if "Profit" is using a percent or mode 
value.
<FONT face=Arial color=#0000ff 
size=2> 
With 
theses conditionnal stops, you can imagine any combination of stops according to 
the way your position is evolving. For example : "after 10 days, exit the 
position if it shows a loss, otherwise, use a trailing 
stop".
<FONT face=Arial color=#0000ff 
size=2> 
Would 
you find this feature interresting ? Tomasz, would it be a nightmare to 
code ?
<FONT face=Arial color=#0000ff 
size=2> 
Best 
regards, Jérôme ULRICH

  <FONT face=Tahoma 
  size=2>-----Message d'origine-----De : jwilsonp2a 
  [mailto:j1wilson@xxxxxxxxxxx]Envoyé : jeudi 23 octobre 2003 
  09:05À : amibroker@xxxxxxxxxxxxxxxObjet : 
  [amibroker] trailing stop question from new 
  userHi,I am trying to implement a two 
  tiered stop loss, one part being a trailing stop, the other a fixed stop. 
  I want a 3% trailing stop if I am at least 10% profitable, else I want a 
  fixed stop loss price.I thought I had it, but can't quite figure out 
  how to utilize a variable in the ApplyStop(2,x,3,true,false) command. It 
  is the "x" I just showed that needs to be a 1 to enable, or a 0 to 
  disable.Here is a portion of my 
  code:==================================================...BuyPrice 
  = Max(BuySTOP,Low);SellPrice = 
  Min(SellSTOP,High);profit_ten_percent = (((High - BuyPrice)/BuyPrice) 
  >= 0.10);enable_stop = 
  IIf(profit_ten_percent,1,0);ApplyStop(2,enable_stop,3,True,False);Sell 
  = 
  Cross(SellPrice,Low);==================================================It's 
  the "enable_stop" variable that fouls this up. Is this strategy even 
  possible? I would greatly appreciate any help on this.Thank you, 
  JimSend 
  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.