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

[amibroker] debugging in AB



PureBytes Links

Trading Reference Links

Try this:

/* SWING CHART */

SetBarsRequired( 200, 200 ); // needed for script 

swingsize = 10;

HP = HHVBars( High, swingsize ) == 0;

LP = LLVBars( Low, swingsize ) == 0;

EnableScript("jscript");

<%

result = VBArray(AFL("High")).toArray();

function TrendLine( starti, startv, endi, endv )

{

for( j = starti; j <= endi; j++ )

{ 

result[ j ] = startv + ( j - starti )*(endv-startv)/(endi-starti);

}

}

High = VBArray(AFL("High")).toArray();

Low = VBArray(AFL("Low")).toArray();

HP = VBArray(AFL("HP")).toArray();

LP = VBArray(AFL("LP")).toArray();

endi = -1;

starti = -1;

dir = 0;

for( i = High.length - 0; i >= 0; i-- )

{

if( dir == 1 && LP[ i ] )

{

TrendLine( i, Low[ i ], endi, endv );

endi = i;

endv = Low[ i ];

dir = -1;

}

else

if( dir == -1 && HP[ i ] )

{

TrendLine( i, High[ i ], endi, endv );

endi = i;

endv = High[ i ];

dir = 1;

}

else

if( dir == 0 && endi == -1 && LP[ i ] ) 

{

endi = i;

endv = Low[ i ];

dir = -1;

}

else

if( dir == 0 && endi == -1 && HP[ i ] ) 

{

endi = i;

endv = High[ i ];

dir = 1;

}

}

AFL("Graph0")=result;

%>

Graph0Color=colorRed;

Graph1=Close;

Graph1Color = colorBlack;

Graph1Style=styleCandle;



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
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/