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

[amibroker] Re: Why writeif returns the same value all the time?


  • Date: Sat, 13 Mar 2010 18:23:18 -0000
  • From: "j0etr4der" <j0etr4der@xxxxxxxxx>
  • Subject: [amibroker] Re: Why writeif returns the same value all the time?

PureBytes Links

Trading Reference Links

I tried on a watchlist with 60 stocks.  There were both Trend UP and Trend Downs, BUT for any one stock, the results were the same (either  all Up or all down Down.)  Something else is wrong other than WriteIf.

Good luck.  

--- In amibroker@xxxxxxxxxxxxxxx, "googool123123" <bfallahi@xxx> 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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/