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

RE: [amibroker] Why doesn't this work



PureBytes Links

Trading Reference Links




the 
correct spelling of the function is "IIF()" and not "IFF()". It's that simple 
;-)
<FONT face=Arial color=#0000ff 
size=2> 
Best 
regards
Jérôme 
ULRICH

  <FONT face=Tahoma 
  size=2>-----Message d'origine-----De : the_real_redleg 
  [mailto:james.hall3@xxxxxxxxxxx]Envoyé : vendredi 28 novembre 
  2003 16:12À : amibroker@xxxxxxxxxxxxxxxObjet : 
  [amibroker] Why doesn't this workGreetings 
  all,I'm trying to backtest a trailing stop that is only implemented 
  after a certain profit target has been reach. I HAVE been trying to 
  figure out if/else looping which should be the answer according to 
  previous discussions here (really!). But reading through the AFL 
  reference manual again this morning it seems to me that I should be 
  able to do it by using the IFF function to assign differing results to 
  variables that I then use within the applystop function. Here is the code 
  that is not working. (What I am want to do (for this example) is have a 50 
  pip stoploss, but once I have 30 pips of profit switch to a 20 pip 
  trailing stop.) Buy = Cross(EMA(Close,12),EMA(Close,26));Short = 
  Cross(EMA(Close,26),EMA(Close,12));Sell = Short;Cover = 
  Buy;PositionSize=100000;Var1=iff(Close>=(BuyPrice+0.003),2,1);Var2=iff(Close<(BuyPrice+0.003),0.005,0.002);ApplyStop(Var1,2,Var2,True,False);I 
  get a syntax error right at the first IFF. Why does this give me a 
  syntax error?Is it possible to do what I'm attempting using this 
  general approach? (I'll keep banging my head against the intricacies of 
  if/else looping if I have to, but this would sure be a lot simpler. 
  Even easier would be an if/else function that works on 
  arrays!)Thanks in advance for your help.JamesSend 
  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.