| 
 
 There is nothing wrong with writeIf() try
this explration:
 trendUp = mtRandom()>0.5;
 Filter
= 1;
 trendText = WriteIf(trendup , "Trend UP", "Trend Down");
 AddTextColumn(trendText
, "Trend");
 
 On 3/13/2010 6:09 PM, googool123123 wrote:
 
  
  
could someone please tell me why in the following code
 the line
 
 trendText = WriteIf(trendup , "Trend UP", "Trend Down");
 
 always returns the same value regardless of the values of Coppock and
CoppockMinusN
 
 it always returns "Trend UP"
 
 Thanks
 
 
 here's the code
 
 TimeFrameSet( inMonthly ); // switch now to hourly
 
 
 //Returns the array with months(1-12)
 monthArray = Month();
 
 closeCurrentMonth = C;
 closeLatMonth = Ref(C, -1);
 
 Coppock =
 (ROC(Close,14 )*10 + ROC(Close,11)*10 +
 ROC(Ref(Close,-1),14)*9 +   ROC(Ref(Close,-1),11)*9 +
 ROC(Ref(Close,-2),14)*8 +   ROC(Ref(Close,-2),11)*8 +
 ROC(Ref(Close,-3),14)*7 +   ROC(Ref(Close,-3),11)*7 +
 ROC(Ref(Close,-4),14)*6 +   ROC(Ref(Close,-4),11)*6 +
 ROC(Ref(Close,-5),14)*5 +   ROC(Ref(Close,-5),11)*5 +
 ROC(Ref(Close,-6),14)*4 +   ROC(Ref(Close,-6),11)*4 +
 ROC(Ref(Close,-7),14)*3 +   ROC(Ref(Close,-7),11)*3 +
 ROC(Ref(Close,-8),14)*2 +   ROC(Ref(Close,-8),11)*2 +
 ROC(Ref(Close,-9),14) +   ROC(Ref(Close,-9),11))/2;
 
 N = 1;
 
 CoppockMinusN =
 (ROC(Ref(Close, -N),14 )*10 +           ROC(Ref(Close, -N),11)*10 +
 ROC(Ref(Ref(Close, -N),-1),14)*9 +   ROC(Ref(Ref(Close, -N),-1),11)*9 +
 ROC(Ref(Ref(Close, -N),-2),14)*8 +   ROC(Ref(Ref(Close, -N),-2),11)*8 +
 ROC(Ref(Ref(Close, -N),-3),14)*7 +   ROC(Ref(Ref(Close, -N),-3),11)*7 +
 ROC(Ref(Ref(Close, -N),-4),14)*6 +   ROC(Ref(Ref(Close, -N),-4),11)*6 +
 ROC(Ref(Ref(Close, -N),-5),14)*5 +   ROC(Ref(Ref(Close, -N),-5),11)*5 +
 ROC(Ref(Ref(Close, -N),-6),14)*4 +   ROC(Ref(Ref(Close, -N),-6),11)*4 +
 ROC(Ref(Ref(Close, -N),-7),14)*3 +   ROC(Ref(Ref(Close, -N),-7),11)*3 +
 ROC(Ref(Ref(Close, -N),-8),14)*2 +   ROC(Ref(Ref(Close, -N),-8),11)*2 +
 ROC(Ref(Ref(Close, -N),-9),14) +      ROC(Ref(Ref(Close, -N),-9),11))/2;
 
 trendUp = IIf(Coppock > CoppockMinusN, True, False);
 
 
 trendText = WriteIf(trendup , "Trend UP", "Trend Down");
 AddTextColumn(trendText , "Trend");
 
 
 __._,_.___
 
 **** IMPORTANT PLEASE READ ****
 This group is for the discussion between users only.
 This is *NOT* technical support channel.
 
 TO GET TECHNICAL SUPPORT send an e-mail directly to
 SUPPORT {at} amibroker.com
 
 TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
 http://www.amibroker.com/feedback/
 (submissions sent via other channels won't be considered)
 
 For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
 http://www.amibroker.com/devlog/
 
 
 
 
 ![]()  
 
 __,_._,___
 |