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

Re: [amibroker] Help with WriteIF function



PureBytes Links

Trading Reference Links




Hello,
 
Was already on this list. WriteVal, WriteIf do not really 
write anything. They just return the string.
And only string at the global level causes output. If you wrap 
it into { } braces it won't generate any output.
So you need to do something along these lines:
 
N( output = "" );
 
if( ...)
{
  output = output + WriteVal  / WriteIf
}
 
output; // here text is outputted
 
 
As I wrote before there will be printf function in one of 
the next betas that will allow to print
from inside funciton or nested curly brices 
without using string variable as above. 
Also WriteVal will be renamed to NumToStr or something like 
that. (old will be left untouched
for backward compatibility however)
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Gary 
  A. Serkhoshian 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, October 08, 2003 3:29 
  AM
  Subject: [amibroker] Help with WriteIF 
  function
  
  Hi all,
   
  Can't get the writeif to give commentary when nested in an if 
  statement.  Any help/ideas appreciated.
   
  See below, and thanks in advance.
   
  Regards,
  Gary
   
  
  //CHART TYPE CALCS
  LINECHART = IIf<FONT 
  size=2>((C == O) AND (C == H) AND 
  (C == L) AND V == <FONT color=#ff00ff 
  size=2>0,1<FONT 
  size=2>,0);
  LASTLINECHART = LastValue<FONT 
  size=2>(LINECHART);
   
  //=================================== CANDLE OR LINE CHART 
  ========================================<FONT color=#800000 
  size=2>
  if (LASTLINECHART == <FONT color=#ff00ff 
  size=2>1)
  {
  PlotForeign(<FONT color=#0000ff 
  size=2>Name(),<FONT color=#0000ff 
  size=2>Name<FONT 
  size=2>(),colorDefault,styleLine|styleThick|styleDots);
  }
  if (LASTLINECHART == <FONT color=#ff00ff 
  size=2>0)
  {
  PlotForeign(<FONT color=#0000ff 
  size=2>Name(),<FONT color=#0000ff 
  size=2>Name<FONT 
  size=2>(),colorDefault,styleCandle|styleThick);
  }
  //CODE BELOW FOR BAR CHARTS ONLY
  if (LASTLINECHART == <FONT color=#ff00ff 
  size=2>0) 
  {
  //===================================== VOLUME AT PRICE 
  ==========================================<FONT 
  color=#0000ff size=2>
  PlotVAPOverlay( <FONT color=#ff00ff 
  size=2>300, <FONT color=#ff00ff 
  size=2>5, colorBrightGreen, <FONT 
  color=#ff00ff size=2>4 ); <FONT color=#008000 
  size=2>
  //================================= FADE, FAKE, GREEN, SQUAT 
  =====================================
  RANGE = H-L;
  WMFI = (RANGE / V) * <FONT color=#ff00ff 
  size=2>100;
  //GREEN
  GREEN = V > (Ref<FONT 
  size=2>(V,-1) * 
  1.10) AND WMFI 
  > Ref<FONT 
  size=2>(WMFI,-1<FONT 
  size=2>);
  PlotShapes(<FONT color=#0000ff 
  size=2>IIf(GREEN == <FONT color=#ff00ff 
  size=2>1,shapeHollowSmallCircle,shapeNone), 
  colorBrightGreen, 0<FONT 
  size=2>, H,5<FONT 
  size=2>);
  //SQUAT
  SQUAT = V > (Ref<FONT 
  size=2>(V,-1) * 
  1.10) AND WMFI 
  < Ref<FONT 
  size=2>(WMFI,-1<FONT 
  size=2>);
  PlotShapes(<FONT color=#0000ff 
  size=2>IIf(SQUAT == <FONT color=#ff00ff 
  size=2>1,shapeHollowSmallCircle,shapeNone), 
  colorYellow, 0, 
  H,5<FONT 
  size=2>);
  //FAKE
  FAKE = V < (Ref<FONT 
  size=2>(V,-1) * 
  1.10) AND WMFI 
  > Ref<FONT 
  size=2>(WMFI,-1<FONT 
  size=2>);
  PlotShapes(<FONT color=#0000ff 
  size=2>IIf(FAKE == <FONT color=#ff00ff 
  size=2>1,shapeHollowSmallCircle,shapeNone), 
  colorBlack, 0, 
  H,5<FONT 
  size=2>);
  //FADE
  FADE = V < (Ref<FONT 
  size=2>(V,-1) * 
  1.10) AND WMFI 
  < Ref<FONT 
  size=2>(WMFI,-1<FONT 
  size=2>);
  PlotShapes(<FONT color=#0000ff 
  size=2>IIf(FADE == <FONT color=#ff00ff 
  size=2>1,shapeHollowSmallCircle,shapeNone), 
  colorWhite, 0, 
  H,5<FONT 
  size=2>);
  //COMMENTARY
  WriteIf(GREEN , <FONT color=#ff00ff 
  size=2>"\nGREEN =VOL UP & RANGE UP (GREEN)"<FONT 
  size=2>,
  WriteIf(SQUAT, <FONT color=#ff00ff 
  size=2>"\nYELLOW = VOL UP & RANGE DN (SQUAT)"<FONT 
  size=2>,
  WriteIf(FADE, <FONT color=#ff00ff 
  size=2>"\nWHITE = VOL DN & RANGE DN (FADE)"<FONT 
  size=2>,
  "\nBLACK = VOL DN & RANGE UP (BLACK)")));
  }
  
  
  Do you Yahoo!?<A 
  href="">The 
  New Yahoo! Shopping - with improved product search 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












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.