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

Re: [amibroker] Danton Stops - Sanity check needed



PureBytes Links

Trading Reference Links

Backtest will only show those trades actually taken
This will depend on a number of factors including Available equity,
trade size(you can set with posi, allowable number of positions (you
can set maximum) etc
Here is the options as I iften use them in the AFL
hope this helps
Check the help screens for backtesting tutorial

SetFormulaName("System 39");
SetTradeDelays( 1, 1, 1, 1 );
SetOption( "initialequity", 20000 );
PositionSize = 4000;
SetOption( "MaxOpenPositions", 10 );
SetOption( "PriceBoundChecking", 1 );
SetOption( "CommissionMode", 2 );
SetOption( "CommissionAmount", 32.95 );
PositionScore = 100/C;


On Sun, 13 Mar 2005 23:04:48 -0000, Jeff <jeffstr@xxxxxxxxxxxxx> wrote:
> 
> 
> Hi guy's, first post.   This group has really helped accelerate the
> learning curve, please accept a big THANK YOU.
> 
> I'm migrating from eSignal and Wealth-Lab and have a bit of
> programming experience but I just can't seem to get a grip on why my
> backtesting and scan results are different.   Specifically, the scan
> shows all the signals, charts look great, buy/sell arrows exact,
> perfect SAR calculations, etc.   But, backtesting shows a subset of
> the scans Buy/Sell signals.
> 
> This script was called Danton Stops over at eSignal, but to me it's a
> nice SAR system using 3 minute charts at the key reversal periods of
> the day.    When time permits, could someone please take a look at the
> backtesting results and possibly why they don't correlate to
> chart/scan signals.   I've been using symbol XLNX to debug.
> 
> Thanks,
> Jeff
> 
> ////////////////////////////////////////
> // Danton STOP/SAR                    //
> // Written by: Jeff                   //
> ////////////////////////////////////////
> //=================================================
> //Ratio = 0.38;    //Danton Ratio
> nRatio=Optimize("nRatio",0.38,0.0,0.40,0.02);    //Danton Ratio
> dsar = Close;
> long = 1;
> SARcolor = colorBlue;
> ema220=EMA(C,220);
> //=================================================
> for( i = 2; i < BarCount-1; i++ )
> {
> //=================================================
> // Check for reversal
>        reverse =  0;
>        if ( long )
>        {
>                SellSig = Close[i] <= dsar[i-1];
>                if(SellSig)
>                {
>                        long = 0;   reverse = 1;        // reverse position to Short
>                        Sell[i] = 1;
>                        SellPrice[i] = dsar[i-1];
> //                      Short[i] = 1;
> //                      ShortPrice[i] = dsar[i-1];
>                        dsar[i] = round( (High[i] + ( High[i-1] - Low[i-1] ) *
> nRatio)*100)/100;
>                }
>        }
>        else
>        {
>                BuySig = Close[i] >= dsar[i-1];
>                if(BuySig)
>                {
>                        long = 1;   reverse = 1;    //reverse position to long
>                        Buy[i] = 1;
>                        BuyPrice[i] = dsar[i-1];
> //                      Short[i] = 1;
> //                      ShortPrice[i] = dsar[i-1];
>                        dsar[i] = round( (Low[i] - ( High[i-1] - Low[i-1] ) *
> nRatio)*100)/100;
>                }
>        }
> //=================================================
> // No reversal - Adjust Stop, if Applicable
>        if ( reverse == 0 )
>        {
>                dsar[i] = dsar[i-1];  //Set default to last SAR
>                if ( long )
>                {
>                        RangeExpanding = Close[i] > Close[i-1] OR Low[i] < Low[i-1];
>                        if (RangeExpanding)
>                        {
>                                Stop = round( (Low[i] - ( High[i-1] - Low[i-1] ) *
> nRatio)*100)/100;
>                                if (Stop > dsar[i-1] )   dsar[i] = Stop;
>                        }
>                }
>                else
>                {
>                        RangeExpanding = Close[i] < Close[i-1] OR High[i] > High[i-1];
>                        if (RangeExpanding )
>                        {
>                                Stop = round( (High[i] + ( High[i-1] - Low[i-1] ) *
> nRatio)*100)/100;
>                                if (Stop < dsar[i-1] )    dsar[i] = Stop;
>                        }
>                }
>        }
> //=================================================
> //Color the SAR's
>        if ( long )
>       SARcolor[ i ] = colorBlue;
>        else
>       SARcolor[ i ] = colorRed;
> //=================================================
> }
> Cover=Buy;
> Short=Sell;
> Filter=Buy OR Sell OR Short OR Cover;
> Buy=ExRem(Buy,Sell);
> Sell=ExRem(Sell,Buy);
> Short=ExRem(Short,Cover);
> Cover=ExRem(Cover,Short);
> AddColumn(Buy,"Buy");
> AddColumn(Sell,"sell");
> AddColumn(Short,"short");
> AddColumn(Cover,"cover");
> 
> Title=  Name() +" - "+Interval(2) + "  "+Date()+": Open"+WriteVal(O)+
>        ", Hi"+WriteVal(H)+",  Lo"+WriteVal(L)+
>        ",  Close"+WriteVal(C)+",  Danton"+WriteVal(dsar);
> 
> Plot( Close, "C", colorBlack, styleCandle );
> Plot( dsar, "Stop", SARcolor, styleDots | styleNoLine | styleThick);
> Plot( EMA220, "Stop", colorBlue, styleLine + styleThick);
> PlotShapes(shapeDownArrow*Sell,colorRed,0,dsar+0.05,0);
> PlotShapes(shapeUpArrow*Buy,colorBlue,0,dsar-0.05,0);
> GraphXSpace=3;
> //=================================================
> 
> 
> 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
> 
> 
> 
> 
> 


-- 
Cheers
Graham
http://e-wire.net.au/~eb_kavan/


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

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

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