PureBytes Links
Trading Reference Links
|
Barry,
Look at the ValueWhen() function:
x = ValueWhen( Condition,returned item, occurance);
Hope you noticed the correction I sent out
A
----- Original Message -----
From: "Barry Scarborough" <razzbarry@xxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 14, 2008 8:02 AM
Subject: [amibroker] Re: AFL code question - ARA please explain == 0,ai,1
> Thanks. I just didn't know you could separate the right side of the
> == with commas. That is a new concept for me. Hope it gets through
> all this white hair. Is there an explanation of this in the help text
> or other C like text?
>
> The intrade = (buy,sell); gave me a syntax check. AFL would not allow
> that but it did allow your 0,ai,1 which still blows my mind.
>
> Exrem is OK if you want to trade at the end of the bar or used in
> back testing. During live intraday trading it gets all screwed up and
> I quit using it in live trading and just look at the conditions of MA
> lines or MACD/Sig lines, etc. That does not fail when the positions
> of the lines cross multiple times within a bar. But it and maybe
> exrem still can give multiple signals which is a huge bother as
> trends slowly change directions.
>
> Thanks again,
> Barry
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@xxx> wrote:
>>
>> Barry,
>>
>> ...intrade AND Ref(intrade,-1) == 0 is the condition (when
> intrade turned
>> from zero to 1)
>> ... "ai" is the array address (same as BarIndex() but it is
> corrected for
>> the effects of Quick AFL)
>> ... "1" is the first occurance of the condition stated above.
>>
>> ExRem should work if used properly, but I have never been able to
> use it
>> properly ... there are some quircks to it ... I think
>>
>> Ara
>>
>> ----- Original Message -----
>> From: "Barry Scarborough" <razzbarry@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, October 14, 2008 4:52 AM
>> Subject: [amibroker] Re: AFL code question - ARA please explain ==
> 0,ai,1
>>
>>
>> > Ara that's great.
>> > But what is == 0,ai,1 in the line
>> > buysignal = ValueWhen(intrade AND Ref(intrade,-1) == 0,ai,1);
>> > Please explain the syntax. I have never seen that done.
>> >
>> > Thanks, Barry
>> >
>> > I had to put an ExRem before (Buy,Sell);
>> > To see this work use this example:
>> >
>> > fMA = MA(C, 4);
>> > Buy = fMA > Ref(fMA, -1);
>> > Sell = fMA < Ref(fMA, -1);
>> > // intrade will become 1 at first signal and stay at that value
> until
>> > a Sell Signal arrives
>> > intrade = ExRem(Buy, Sell);
>> > // this will give you the arrayindex value of the Buy Signal.
>> > buysignal = ValueWhen(intrade AND Ref(intrade,-1) == 0, ai, 1);
>> >
>> > Plot(C, "", colorBlack, styleBar);
>> > Plot(intrade, "Intrade", colorBlue, styleOwnScale);
>> > Plot(buysignal , "buysignal ", colorGreen, styleOwnScale);
>> > PlotShapes(Buy * shapeUpArrow, colorGreen, 0, L, -5 );
>> > PlotShapes(Sell * shapeDownArrow, colorRed, 0, H, -5 );
>> > PlotShapes(intrade * shapeCircle, colorBlue, 0, C , 0);
>> >
>> > --- In amibroker@xxxxxxxxxxxxxxx, "Ara Kaloustian" <ara1@> wrote:
>> >>
>> >> You need to first make sure that you eliminate duplicate signals,
>> > so that
>> >> they will not affect the valu you save
>> >>
>> >> Try this:
>> >> bi = barindex();
>> >> ai = bi - bi[0];
>> >> intrade = (Buy,Sell); // intrade will become 1 at first
> signal
>> > and stay
>> >> at that value untill a sell signal arrives
>> >> buysignal = valuewhen(intrade and Ref(intrade,-1) ==0,ai,1); //
>> > this will
>> >> give you the arrayindex value of the buy signal.
>> >>
>> >> BuyHigh = high[buysignal];
>> >>
>> >> ----- Original Message -----
>> >> From: "richpach2" <richpach2@>
>> >> To: <amibroker@xxxxxxxxxxxxxxx>
>> >> Sent: Monday, October 13, 2008 10:31 PM
>> >> Subject: [amibroker] AFL code question
>> >>
>> >>
>> >> > Hello AB Users,
>> >> >
>> >> > Can someone explain please, how do I reference a selected value
>> > of the
>> >> > signal bar?
>> >> > For instance if signal bar is when signal=cross( close, ema
>> > (close,9))
>> >> > then, how do I store "High" of the signal bar for the future
> use
>> > so, I
>> >> > can check if C>"Signal Bar High" occurred in the following
> bars?
>> >> >
>> >> > I looked at BarSince, VarSet, ValueWhen and SelectedValue but,
> I
>> > am a
>> >> > little confused and unsure which one should I use.
>> >> >
>> >> > Any help or comment will be appreciated.
>> >> >
>> >> > Regards
>> >> > Richard
>> >> >
>> >> >
>> >> > ------------------------------------
>> >> >
>> >> > **** IMPORTANT ****
>> >> > This group is for the discussion between users only.
>> >> > This is *NOT* technical support channel.
>> >> >
>> >> > *********************
>> >> > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail
>> > directly to
>> >> > SUPPORT {at} amibroker.com
>> >> > *********************
>> >> >
>> >> > For NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>> >> > http://www.amibroker.com/devlog/
>> >> >
>> >> > For other support material please check also:
>> >> > http://www.amibroker.com/support.html
>> >> >
>> >> > *********************************
>> >> > Yahoo! Groups Links
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> > ------------------------------------
>> >
>> > **** IMPORTANT ****
>> > This group is for the discussion between users only.
>> > This is *NOT* technical support channel.
>> >
>> > *********************
>> > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail
> directly to
>> > SUPPORT {at} amibroker.com
>> > *********************
>> >
>> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> > http://www.amibroker.com/devlog/
>> >
>> > For other support material please check also:
>> > http://www.amibroker.com/support.html
>> >
>> > *********************************
>> > Yahoo! Groups Links
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>
>
>
> ------------------------------------
>
> **** IMPORTANT ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> *********************
> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
> *********************
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
> *********************************
> Yahoo! Groups Links
>
>
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
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/
|