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

Re: [amibroker] Help with IIF



PureBytes Links

Trading Reference Links




Hello,
 
the two codes are the same, except that with 
applystop I was too STUPID to plot the sells arrows, even with the 
help that says:
 
Using Equity( 1 ) evaluates stops and writes BACK signals to sell/cover 
arrays. Equity(1) also removes all extra signals. Depending on kind 
of the stop various valuesare written back to sell/cover array to enable 
youto distinguish if given signal was generated by regularrule or by 
stop. 1 - regular exit2 - max. loss3 - profit target4 - 
trailing5 - ruin stop 6 - n-bar stop
 

Buy1= C> HHV<FONT 
size=1>(Ref<FONT 
size=1>(C,-1<FONT 
size=1>),10);
Buy2=C>Ref<FONT 
size=1>(C,-1<FONT 
size=1>)*1.03;
Buy=Buy1 AND Buy2;
Sell=Ref<FONT 
size=1>(ExRemSpan<FONT 
size=1>(Buy,5<FONT 
size=1>),-5<FONT 
size=1>);
Plot(C,<FONT color=#ff00ff 
size=1>"",1<FONT 
size=1>,64<FONT 
size=1>);
PlotShapes(<FONT color=#0000ff 
size=1>IIf(Buy,
shapeUpArrow,shapeNone),colorGreen,<FONT 
color=#ff00ff size=1>0,L,-<FONT color=#ff00ff 
size=1>10); 
PlotShapes(<FONT color=#0000ff 
size=1>IIf(Sell,
shapeDownArrow,shapeNone),colorRed,<FONT 
color=#ff00ff size=1>0,H,-<FONT color=#ff00ff 
size=1>10); 
 
 
Buy1= C> HHV<FONT 
size=1>(Ref<FONT 
size=1>(C,-1<FONT 
size=1>),10);
Buy2=C>Ref<FONT 
size=1>(C,-1<FONT 
size=1>)*1.03;
Buy=Buy1 AND Buy2;
Sell=0<FONT 
size=1>;
ApplyStop<FONT 
size=1>(stopTypeNBar,stopModeBars,<FONT color=#ff00ff 
size=1>5,0<FONT 
size=1>);
Equity(1<FONT 
size=1>);
Plot(C,<FONT color=#ff00ff 
size=1>"",1<FONT 
size=1>,64<FONT 
size=1>);
PlotShapes(<FONT color=#0000ff 
size=1>IIf(Buy,
shapeUpArrow,shapeNone),colorGreen,<FONT 
color=#ff00ff size=1>0,L,-<FONT color=#ff00ff 
size=1>10); 
PlotShapes(<FONT color=#0000ff 
size=1>IIf(Sell==<FONT color=#ff00ff 
size=1>6,
shapeDownArrow,shapeNone),colorRed,<FONT 
color=#ff00ff size=1>0,H,-<FONT color=#ff00ff 
size=1>10); 
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  john gibb 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, March 10, 2004 6:31 
  PM
  Subject: Re: [amibroker] Re: Help with 2 
  simple BUY conditions
  Hi,Some questions:1) Is this equivalent to 
  Stephane's Exit suggestion:    Sell=0; // to exit via a 
  stop condition instead of 'normally'    
  ApplyStop(stopTypeNBar,stopModeBars,5,0);//to exit after 5 
  bars?2) If so, are these the correct Settings, when using EOD 
  data:    ActivateStopsImmediately turned 
  OFF    Trade delays set to zero    Trade 
  price set to Close?thanks,-john----- Original 
  Message ----- From: "Stephane Carrasset" 
  <s.carrasset@xxxxxxxxxxx>To: 
  <amibroker@xxxxxxxxxxxxxxx>Sent: Wednesday, March 10, 2004 7:42 
  AMSubject: [amibroker] Re: Help with 2 simple BUY 
  conditionsHello,Buy1= C> 
  HHV(ref(c,-1),10);Buy2=C>ref(c,-1)*1.03;Buy=Buy1 and 
  Buy2;sell=ref(exremspan(Buy,5),-5);>> still 
  learning the ropes of AB. Here are 2 simple BUY conditions I> would 
  like to test on a portfolio:> BUY, if>> 1. Close is the 
  highest in 10 days  and> 2. Close is 3% higher than yesterday's 
  Close>> Exit at the Close after 5 days.>> This is 
  what I tried:> ------------------------------------> Close10 = 
  HHV ( Close,10);  //defining a variable here>> Cond1 = C 
  > (1.03 * Ref(Close,-1));  // this is the first condition> 
  Cond2 = C > 
  Close10;                 
  // this is the 2nd condition>> Buy = (Cond1 AND 
  Cond2);>> -----------------------------------------> For 
  EXIT (or SELL) I have defined an EXIT after 5 days under> SETTINGS, 
  STOPS and put down 5 BARS.> Obviously there is something wrong. I get 
  an error message:> "Define BUY / SELL".>> Thanks for 
  helping a greenhorn.>> WernerSend 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.htmlYahoo! 
  Groups LinksSend 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 
  __________ 
  NOD32 1.660 (20040310) Information __________This message was checked 
  by NOD32 antivirus system.<A 
  href="">http://www.nod32.com


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








Yahoo! Groups Sponsor


ADVERTISEMENT




Click Here















Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.