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

Re: [amibroker] Problem with Status("actionEx")



PureBytes Links

Trading Reference Links



Hello,
 
It *DOES* work, but as I explained in the Manual, in the chapter I pointed out in my previous reply:
 
 
"WriteIf in fact does not "write" anything. The name is misleading but it is left
for easy translation of MS formulas to AmiBroker.
WriteIf is just "TextIIF" it RETURNS string value depending on condition.
 
In commentary window, statements evaluating to STRINGS on global level
are displayed in the output window. However if you do the same inside the FUNCTION
it is no longer in global level (it is on LOCAL, FUNCTION level).
 
To display actual string in this case use PRINTF function:
http://www.amibroker.com/f?printf
 

function comment(indicator)
{
printf( "\nComment...\n" );
 
printf( WriteIf(1, "TrueText", "FalseText") );
printf( WriteVal(indicator) + "\n" );
}
"
 
In other words, STRINGS expressions that are on global level, i.e. NOT surrounded with { }
do display in commentary, but those on tested level don't.
 
All new codes should use printf().
 
The behaviour outlined above is for compatibility with old formulas that were written
in ancient times, when there was no user-defined functions, no printf() and no if-else.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Sunday, October 04, 2009 10:42 PM
Subject: Re: [amibroker] Problem with Status("actionEx")

I'm afraid that I haven't made myself clear about what I really want to know.  So --
What I really want to know is WHY my snippet, containing
Status("actionEx"), doesn't work. 

What is it that I do not understand about Status("actionEx")?  I am not looking for alternative ways to work around a problem that I do not understand, but I am looking to understand the problem in the first place.  Status() appears to me to be an extremely useful function which I want to learn ALL about.

Thank you.
-- Keith

Tomasz Janeczko wrote:
 

Look at the manual, esp. COMMENT:

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
Sent: Sunday, October 04, 2009 2:24 PM
Subject: Re: [amibroker] Problem with Status("actionEx")

Mmm, I?m not sure what to tell ya. Only TJ can give you a definitive answer. I have an idea why, but I can?t prove it. I like experimenting with AFL  and discovered this one a while ago. So, all I have is results through observation and my acceptance of the results.

I can tell ya to read up on the WriteIf function. It will give you a clue, especially TJ?s comments, and an alternative to your code. You can eliminate the IF statement altogether and use WriteIf along with WriteVal or NumToStr for the conversion. 

Something like this:

WriteIf(Stat == Indicator OR Stat == Commentary OR Stat == aToolTip OR Stat == aInterpret, WriteVal(Lowbody, 1.3), "");

or

WriteIf(Stat == Indicator OR Stat == Commentary OR Stat == aToolTip OR Stat == aInterpret, NumToStr(Lowbody, 1.3), "");


 



On Sat, Oct 3, 2009 at 11:23 PM, Keith McCombs <kmccombs@xxxxxxxxxcom> wrote:
 

Tony --
That works fine!!

I don't like to "look a gift horse in the mouth", but, how did you know?  I've looked through AB Users Guide and Help file and can't find where that might be explained.  If you've got the time, I would sure like to know, to get a better understanding of what I am doing.

Thank you so much.
-- Keith

Tony Grimes wrote:

 

Use Printf instead of WriteVal.


On Sat, Oct 3, 2009 at 3:21 PM, Keith McCombs <kmccombs@xxxxxxxxxcom> wrote:
 

Graham --
Thank you for your suggestion.  However, I know I don't need it for just the snippet displayed.

This is from a much larger program where I wish to disable the display in Indicator, Commentary, etc., if/when some other actions are performed. 

When I post a question, rather than post my entire code, I try to break my code down first to just that part that I do not understand, and post it.

So my question remains.
-- Keith


Graham wrote:
 

remove the if line altogether, you should not need it


--
Cheers
Graham Kav
AFL Writing Service
http://www.aflwriting.com

2009/10/3 Keith McCombs <kmccombs@xxxxxxxxxcom>


Without the 'if()' restriction below, all of the text and WriteVal(), etc. is displayed in the Interpretation Window as it should be.  However, when include the 'if()' restriction it is no longer visible.  I believe it should still be visible because of the "Stat == aInterpret" inclusion in the 'if()'.  If all plot() statements a within the 'if()' restriction, the charts are drawn as expected.

What's wrong?

Indicator = 1; Commentary = 2; aToolTip = 16; aInterpret = 17;
Stat =
Status("actionEx");
if(Stat == Indicator OR Stat == Commentary OR Stat == aToolTip OR Stat == aInterpret){

"Lowbody = " + WriteVal(Lowbody, 1.3);
"Highbody = " + WriteVal(Highbody, 1.3);
"risk = " + WriteVal(risk, 1.3);
"ATRcond = " + WriteVal(ATRcond, 1.3);
"%risk/Equity = " + WriteVal(100*risk/myE);
}


Would appreciate any help I can get.
Thanks.
-- Keith









__._,_.___


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

__,_._,___