[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:25:41 -0000
  • From: "googool123123" <bfallahi@xxxxxxxxx>
  • Subject: [amibroker] Re: Why writeif returns the same value all the time?

PureBytes Links

Trading Reference Links

I am sure there is nothing wrong with writeif.

I was hoping someone could kindly tell me what problem in my code was
always getting the same choice regrdless of the value of the condition

BTW, your mtRandom() suggestion always returns zero for some reason

thanks,
--- In amibroker@xxxxxxxxxxxxxxx, Aron <aron.groups@xxx> wrote:
>
> |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/

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/