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

RE: [amibroker] DebugView and _Trace?



PureBytes Links

Trading Reference Links

All you do is run the debugview program before you run your AFL.  You'll get
a window that you leave running.

Then in your AFL you sprinkle _Trace(  )   statements  at critical points
and inside the parens  you put some literals to tell you what you're looking
at and after the literal you put in the proper function to display a
variable that you want to examine.

The help file for _Trace has a couple of examples, once of which is:

http://www.amibroker.com/library/detail.php?id=586&hilite=_TRACE

When you run your program you'll see the results of the _Trace's in the
debugview window.

Don't make it complicated - it isn't - its VERY simple.

d

> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx 
> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of orionsturtle
> Sent: Tuesday, July 18, 2006 10:03 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] DebugView and _Trace?
> 
> I got the scaling out code from the help files working on the 
> long side and now am tring to convert it to work on shorting. 
> I have shortened the code to what is below just to get it to 
> generate a trade. As it stands right now, at every short 
> signal Cross of the MAs I get an immediate cover in the AA>SCAN. 
> 
> I read on the board here of the _Trace function and 
> debugView. I downloaded DebugView and printed the _trace help 
> file, but I still lack the knowledge to make debugView see my 
> code. Does anyone know of an artical or help file describing 
> the process of hooking up debugView to AmiBroker? I just 
> can't seem to see why this code wont generate a short signal 
> when it will for the buy side. 
> 
> I appreciate all the help this board gives. Thank You!
> 
> OT
> 
> --------------------------------------------------
> FirstProfitTarget = .05; // profit
> TrailingStop = .1; // also in percent
> priceatshort=0;
> Lowsinceshort=0;
> exit = 0; 
> 
> Short = Cross( MA( C, 50 ), MA( C, 10 ) ); Cover = 0 ; 
> 
> 
> for( i = 0; i < BarCount; i++ )
> { 
> 	if( priceatshort == 0 AND Short[ i ] ) 
>     { 
>        priceatshort = ShortPrice[ i ]; 
>     } 
> 	if( priceatshort > 0 ) 
>     { 
>        Lowsinceshort = Min( Low [ i ], Lowsinceshort ); 
> 	      //PT1
>       if( exit == 0 AND Low[ i ] <= ( 1 - FirstProfitTarget * 0.01 ) 
> * priceatshort) 
>        { 
>          exit = 1; 
> 		  ShortPrice[i] = ( 1 - FirstProfitTarget * 0.01 ) * 
> priceatshort;  
>          Short[ i ] = sigScaleOut; 
>        } 
> 
>        //Trail Stop Loss
>       if( High[ i ] >= ( 1 + TrailingStop * 0.01 ) * Lowsinceshort ) 
>        { 
>          exit = 4;    
>          CoverPrice[ i ] = ( 1 + TrailingStop * 0.01 ) * 
> Lowsinceshort ; 
>        } 
> 
>       //Reset for the next loop
>       if( exit >= 3 ) 
>        { 
>          Short[ i ] = 0; 
>          Cover[ i ] = exit + 1; // mark appropriate exit code 
>          exit = 0; 
>          priceatshort= 0; // reset price 
>          Lowsinceshort = 0; 
>        } 
>     } 
> } 
> 
> SetPositionSize( 50, spsPercentOfEquity ); /*Initial % of equity to 
> be traded.*/
> SetPositionSize( 50, spsPercentOfPosition * ( Short == 
> sigScaleOut ) ); /* percentage to scale out when PT's are hit*/
> 
> 
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> --------------------~--> 
> Check out the new improvements in Yahoo! Groups email.
> http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/GHeqlB/TM
> --------------------------------------------------------------
> ------~-> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
>