PureBytes Links
Trading Reference Links
|
Bob and Dominick
Thank you both for pointing out the error of my ways,
and steering me through the Linearray help files.
I need to have a NUMBER or VALUE for each x0,x1,y0,y1,
and not an array.
I can see now that Buyprice is an ARRAY.
Anything based on ValueWhen is an ARRAY.
The only function that I have been able to find that
extracts these values is Lastvalue.
Here is code that does what I want it to:
********************
Buy = Cross( Close,EMA(C,30));
x0 = LastValue(ValueWhen(Buy,BarIndex(),1 ) );
y0 = LastValue(ValueWhen(Buy,C,1) );
x1 = x0 + 260;
y1 = y0 * 1.2;
y2 = y0 * 2;
MingainLine = LineArray(x0,y0,x1,y1,0,1);
Maxgainline = LineArray(x0,y0,x1,y2,0,1);
Plot(C, "", 1, 64);
Plot(EMA(C,30),"", 1,1);
PlotShapes(shapeUpArrow * Buy, colorBlue, 0 , L, -15);
Plot(mingainLine, "line", colorGreen, 1);
Plot(Maxgainline,"maxgain",colorRed,1);
**********
I note that if I use the
LineArray(x0,y0,x1,y1);
format rather than the
LineArray(x0,y0,x1,y1,0,1);
then the line draws only for the split second that I
click on Apply in the Inicator Builder.
Not sure why, (I will leave that to others to figure
out) but the above works fine for now.
Like learning a new language,some things are starting
to make sense after more than a year of using AB.
If I was learning French not only would I be
unintelligible I would have a most amusing accent.
On to the next project.
Regards
ChrisB
--- Dominick <Dom2000@xxxxxxxxxxx> wrote:
> Here's what I got when hitting F1 after the error
> was highlighted. It
> may mean one of your variables is a string
> instead of a close,open high etc.
>
>
> Error 5. Argument #1 has incorrect type (the
> function expects
> different argument type here)
>
> This error occurs when argument passed during
> function call has invalid
> type. For example when you pass string instead of
> array
>
> MA( "test", 5 ); // wrong, Moving average expects
> array as first argument
> AddColumn("Test", "Caption"); // wrong, AddColum
> expects array as first
> argument
>
> AddTextColumn("Test", "Caption"); // correct,
> AddTextColumn expects text
>
> Below is what Bob wrote you. Notice there's only 4
> variables compared to
> your 6.
>
> Linearray needs two each X and Y points and
> rightfully complained when you
> fed it two Y arrays.
>
> The code editor in 4.69 catches that Arg #4 has
> incorrect type, but that's
> also true for Arg #2.
>
> Was there a reason why you used
> LineArray(x0,y0,x1,y1, 0, 1) in place of the
> default LineArray(x0,y0,x1,y1)?
>
>
>
>
>
>
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|