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

Re: [amibroker] Re: Code Question



PureBytes Links

Trading Reference Links



The plots are correct but your IIF() is incorrect (assign it to a variable and it will return the value of the 2nd or 3rd parameter).  I just checked and the code that I listed works as I described so you can start there and modify as desired if this is not what you want.
 
Bill
----- Original Message -----
Sent: September 22, 2009 7:05 PM
Subject: [amibroker] Re: Code Question

Bill, Thanks for taking a look at this for me. I have looked at the section you described but I guess I am a little slow at this. I replaced using == etc but no change. I am not sure if you plotted this but the plots seem correct. The problem is when I use an exploration so I guess I am not making a connection as to where its off. I will go back and re-read that section as see if this thick head can make sense of it.

Thanks
DM

--- In amibroker@xxxxxxxxxxxxxxx, "wavemechanic" <fimdot@xxx> wrote:
>
> You have a problem with the way IIF() is used.  See "Common Coding Mistakes" in the Users Guide.
>
> From your description, I assume that you want to go through your symbols, characterize the last value of the divergence and associate the divergence with a symbol.  If so, a simple way is to replace the code after the Plot() section with the following which will put 1 or 0 in the divergence columns.
>
> addtextcolumn(name(), "symbol", 1.2, colorblack);
> addcolumn(posdiv, "posdiv", 1.2, colorlime);
> addcolumn(negdiv, "negdiv", 1.2, colorred);
> filter = status("lastbarinrange");
>
> Bill
>   ----- Original Message -----
>   From: dmcleod1981
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: September 22, 2009 10:55 AM
>   Subject: [amibroker] Code Question
>
>
>   I found this code in the TASC articles in the member section. I was trying to add some code to be able to run an explore to possible divergences. When I plot the indicator it seems to be correct but in the columns both conditions show true. It is a simple code mistake but at the moment it escapes me why. Can anyone point out the obvious to me?
>
>   Thanks
>   DM
>
>   /*TWO-POINT PROBLEM OF THE RATE OF CHANGE
>
>   In the "Two-point problem of the Rate Of Change" article Martti Luoma AND Jussi Nikkinen
>   present the modification of classic ROC indicator that can be constructed two ways in AmiBroker.
>   First way does NOT require writing any single line of code. You can construct ROCadj AND other
>   indicators using AmiBroker's powerful drag AND drop technology. To create ROCadj, select Chart tab,
>   go to Indicators folder, double click on ROC - Rate Of Change - this will create new chart pane with ROC.
>   Then go to Averages folder, click AND drag EMA - Exponential Moving Average onto ROC chart.
>   Your indicator is ready. Now simply adjust ROC period to 1 AND EMA smoothing period to 21 using
>   Parameters window. Second way is to use the formula presented in Listing 1. Just type it into
>   Formula Editor AND press Insert Chart button.
>   */
>
>   periods = Param("Periods", 21, 2, 200, 1 );
>   ROCadj = periods * EMA( ROC( C, 1 ), periods );
>
>   /*Added Divergence to original formula*/
>
>   RocSlope=LinRegSlope(ROC(C,periods),periods);
>   MARocSlope=LinRegSlope(ROCadj,periods);
>   PosDiv=MARocSlope>=RocSlope;
>   NegDiv=MARocSlope<RocSlope;
>
>
>   //Plots
>   Plot( ROCadj, "ROCadj "+periods, colorRed, styleThick );
>   // the line below adds standard ROC overlay
>   Plot( ROC( C, periods ), "ROC "+periods, colorBlue );
>
>   Plot(PosDiv,"Positive",colorLime,styleOwnScale);
>   Plot(NegDiv,"Positive",colorRed,styleOwnScale);
>   IIf(PosDiv>0,AddTextColumn("Positive","Positive Divergence",1.2,colorLime),0);
>   IIf(NegDiv>0,AddTextColumn("Negative","Negative Divergence",1.2,colorRed),0);
>
>   Filter=1;
>   
>
>
>
>   ------------------------------------
>
>   **** 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
>




------------------------------------

**** 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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx
    mailto: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/


__._,_.___


**** 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

__,_._,___