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

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


  • Date: Sun, 14 Mar 2010 03:35:47 -0000
  • From: "googool123123" <bfallahi@xxxxxxxxx>
  • Subject: [amibroker] Re: Why writeif returns the same value all the time?

PureBytes Links

Trading Reference Links



Thank you very much,

I actually had read the manual, but had failed to grasp the significance of the comment about "current SelectedValue of the _expression_"

Now that you show me the way, I understand it, of course :-)

Thanks, again

Regards


> Hello,
>
> You should probably start reading the MANUAL:
> http://www.amibroker.com/guide/afl/afl_view.php?writeif
>
> Read the Second comment !!!
> ===================
>
>
> You should use this instead
>
> trendText = WriteIf(trendup , "Trend UP", "Trend Down");
> AddColumn( IIF( trendup, Asc("U"), Asc("D") ) , "Trend", formatChar );
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
>
> On 2010-03-13 19:29, googool123123 wrote:
> >
> >
> > that is how I am running it, against all quotes of the _*same stock
> > *_
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "j0etr4der" j0etr4der@ wrote:
> > >
> > > 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@ 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___