Forum Replies Created
-
AuthorPosts
-
LeeDanelloParticipant
What about payoff ratio. Would have thought that you should be trying to aim greater than 1.0
LeeDanelloParticipantJulian Cohen wrote:I’ll give it a try. If I am doing an ASX test I manually adjust the commission rate in the table. I was using the US commissions for the ASX but I’ll try with the correct one and see how it goes.That’s where it goes wrong with the ASX. The minimum is 0.5c per share or a minimum of $1 for US and a flat fee of $6 for Aussie stocks. By using US commissions on ASX stocks will cause commission drag and render the system useless.
LeeDanelloParticipantNick Radge wrote:Quote:tried it on the All Ords and that also bombed ie equity went to zero.Just ensure your commission settings and currency settings are correct. I tend to see the comm rates for ASX left at US rates which destroys the strategy.
You’re right Nick. I screwed the commissions up.
Seems to work OK on the ASX. I used the SetOption filter to set the the IB commission rate to $6 which overrides the commission table. Unfortunately I haven’t able to figure that one out for the US market.
I’ll have to save one system as ASX and one as US. One minor oversight can screw the results
Julian, try testing the ASX with the following two lines in your code.
Put it under
Code://options in automatic analysis settings
SetOption(“CommissionMode”,2); //Fixed Dollar Amount
SetOption(“CommissionAmount”,6); //Use IB commision ratesLeeDanelloParticipantJulian Cohen wrote:Have you tried it on the ASX Maurice? I couldn’t get a good result on the ASX although I’m still waaaay behind you guys so I’m probably making some idiot mistake.Hi Julian,
I tried this on the All Ords and it completely bombed. I coded up a similar system which tests well on the S&P500 and Russell1000 and tried it on the All Ords and that also bombed ie equity went to zero. Very interesting….Conversely, my original mean reversion system which was coded with the ASX in mind tests reasonably well on the ASX and US markets. That one is based on Cesar Alvarez RSI system. I haven’t looked in to why that works on both the ASX and US markets while the Bollinger system doesn’t.
LeeDanelloParticipantWhen you say you test each condition in a separate system, what do use as the base system?
LeeDanelloParticipantJulian Cohen wrote:Well that’s almost what you are doing with boot camp. It allows you to run Windows completely on a Mac, but you have the choice of which OS you want to run. I mainly use Mac as I do a lot of photography and Adobe Photoshop and other programs run really well on Mcs, plus the screen beautiful.So is that a dual boot?
I think Trent said that he ran his as a virtual machine which means you have to boot into the Mac enviroment and was only allocated 2GB.
https://www.thechartist.com.au/Forum/discussion/265-amibroker-on-mac-data.html#746David Brown wrote “For example, in Virtual Box a Windows 10 64Bit virtual machine running a 20 year backtest using the Premium Data Alpha PDU database would take about
20 mins. Now the same test takes about 6 mins. Just running an exploration takes a few seconds. The Windows virtual machine is configured for 2 CPUS and 4GB RAM.”Good luck when he does a Monte Carlo. That will take him days.
LeeDanelloParticipantMost say that Macs are better than PCs, but is that just the software or the machine itself? So if you bought an Apple machine could you wipe the OS and install Windows on it?
LeeDanelloParticipantResults of a 1000 run Monte Carlo with 20% trade skipping
LeeDanelloParticipantJulian,
Save it in the following folder and after you’ve done a backtest it will automatically show up in the reports
LeeDanelloParticipantTrent Rothall wrote:How do you get the MDD column on the VAMI table Maurice?I am not sure if my thoughts are correct maybe Nick could comment, but I like to see Ave trade P/L % closer to 1(or above) than 0, I just think the smaller the ave win the easier it is for the system to go out of sync with the market (enter DD) or lose it edge all together because the edge is only small to start off with.
I put the code in the AFL Template & Looping Reference Library.
Paste it into report charts
LeeDanelloParticipantEnhanced Profit Table
Code:EnableTextOutput( 3 ); // enable HTML output into report (Version 5.84 or higher!)function CalendarDays()
{
ddsince1900 = DaysSince1900();
result = ddsince1900 – ddsince1900[0];
return result;
}// — MaxDD —
EQ = C;
MaxEQ = Highest( EQ );
DD = EQ – MaxEQ;
MaxDD = Lowest( DD );
DDpct = 100 * ( EQ – MaxEQ ) / MaxEQ;
MaxDDpct = Lowest( DDpct );// — CAR —
bi = BarIndex();
fbr = Status( “firstbarinrange” );
lbr = Status( “lastbarinrange” );
fbrbi = LastValue( ValueWhen( fbr, bi ) );
lbrbi = LastValue( ValueWhen( lbr, bi ) );
cd = CalendarDays();
Days = cd[ lbrbi ] – cd[ fbrbi ];
CAR = 100 * ( ( eq / eq[ fbrbi ] ) ^ ( 365 / Days ) – 1 );fillText = StrFormat( ” “);
Title = StrFormat( “Equity = $ %.2f%%, CAR = %.2f%%, MaxDD = $ %.2f%%, (= %.2f%%)”, EQ, CAR, MaxDD, MaxDDpct );
SetGradientFill( colorDarkGreen, ColorRGB( 0, 204, 0 ), 0 );
Plot( EQ, “Portfolio Equity”, colorDarkGreen, styleGradient | styleLine );
// — drawdown trenches in red —
PlotOHLC( MaxEQ, MaxEQ, EQ, MaxEQ, “”, colorRed, styleCloud );// — paint log graph —
SetChartOptions( 2, chartLogarithmic );////////////////////////////////////////////////////////////////////////////
////////////////////////////
// From: 3. Profit Table.afl
////////////////////////////yr = Year();
mo = Month();YearChange = yr != Ref( yr, 1 );
MonChange = mo != Ref( mo, 1 );FirstYr = 0;
LastYr = 0;startbar = 0;
////////////////////////////
// SKIP non-trading bars
////////////////////////////for ( i = 0; i < BarCount; i++ ) { if ( eq[ i ] ) { startbar = i; break; } } //////////////////////////// // collect yearly / monthly changes in equity // into dynamic variables //////////////////////////// LastYrValue = eq[ startbar ]; LastMoValue = eq[ startbar ]; MaxYrProfit = MinYrProfit = 0; MaxMoProfit = MinMoProfit = 0; MaxYearEQ = YearDD = MaxYearDD = 0; for ( i = startbar + 1; i < BarCount; i++ ) { MaxYearEQ = Max( EQ[ i ], MaxYearEQ ); YearDD = Nz( 100 * ( EQ[ i ] - MaxYearEQ ) / MaxYearEQ ); MaxYearDD = Min( YearDD, MaxYearDD ); if ( YearChange[ i ] || i == BarCount - 1 ) { Chg = 100 * ( -1 + eq[ i ] / LastYrValue ); VarSet( "ChgYear" + yr[ i ], Chg ); MaxYrProfit = Max( MaxYrProfit, Chg ); MinYrProfit = Min( MinYrProfit, Chg ); if ( FirstYr == 0 ) FirstYr = yr[ i ]; LastYr = yr[ i ]; LastYrValue = eq[ i ]; VarSet("MaxYearDD"+ yr[ i - 1 ], MaxYearDD ); MaxYearEQ = YearDD = MaxYearDD = 0; } if ( MonChange [ i ] || i == BarCount - 1 ) { mon = mo[ i ]; Chg = 100 * ( -1 + eq[ i ] / LastMoValue ); VarSet( "ChgMon" + yr[ i ] + "-" + mon, Chg ); VarSet( "SumChgMon" + mon, Chg + Nz( VarGet( "SumChgMon" + mon ) ) ); VarSet( "SumMon" + mon, 1 + Nz( VarGet( "SumMon" + mon ) ) ); MaxMoProfit = Max( MaxMoProfit, Chg ); MinMoProfit = Min( MinMoProfit, Chg ); LastMoValue = eq[ i ]; } } MonthNames = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec"; function GenProfitTableHTML( ) { printf( "
n” );
printf( “
n” ); Header = “Year,” + MonthNames + “,Yr%%,” + “MDD”;
for ( Col = 0; ( Colname = StrExtract( Header, Col ) ) != “”; Col++ )
{
printf( “” + Colname + “ ” );
}printf( “
n” );
for ( y = FirstYr; y <= LastYr; y++ ) { //Color = ColorRGB( IIf( row == 0 || col == 0 || col == 13, 220, 255 ), 255, IIf( row % 2, 255, 220 ) ); // new row if ( y % 2 ) printf( "
n ” );
else
printf( “n ” ); printf( “%g
“, y );
for ( m = 1; m <= 12; m++ ) { Chg = VarGet( "ChgMon" + y + "-" + m ); if ( NOT IsNull( Chg ) ) { if ( Chg >= 0 )
printf( “%.1f%% “, Chg );
else
printf( “%.1f%% “, Chg );
}
else
printf( “N/A ” );
}if ( y % 2 )
printf( “” );
else
printf( “” ); x = VarGet( “ChgYear” + y );
z = VarGet(“maxYearDD” + y );if ( x >= 0 )
printf( “%.1f%%“, x );
else
printf( “%.1f%%“, x );
Printf( “%.1f%% “, z );
printf( “n” ); // end row
}printf( “
n” ); // new row printf( “
Avg|Mx ” );
for ( m = 1; m <= 12; m++ ) { x = Nz( VarGet( "SumChgMon" + m ) / VarGet( "SumMon" + m ) ); if ( x >= 0 )
printf( “%.1f%% “, x );
else
printf( “%.1f%% “, x );
}
if ( CAR[ BarCount-1 ] >= 0 )
printf( “%.1f%% “, CAR[ BarCount-1 ] );
//PrintInCell( StrFormat(“%.1f”, CAR[ BarCount-1 ] ), Row, 13, ColorRGB( 255, 128, 0 ) );
else
printf( “%.1f%% “, CAR[ BarCount-1 ] );
//PrintInCell( StrFormat(“%.1f”, CAR[ BarCount-1 ] ), Row, 13, ColorRGB( 0, 204, 0 ) );
printf( “%.1f%% “, MaxDDpct[ BarCount-1 ] );
//PrintInCell( StrFormat(“%.1f”, MaxDDpct[ BarCount-1 ] ), Row, 14, ColorRGB( 255, 255, 0) );
//printf( “” );
printf( “
n” );
}
///////////////////////////
// This function checks if currently selected symbol
// is portfolio equity
//////////////////////////
function CheckSymbol()
{
if ( Name() != “~~~EQUITY” AND Name() != “~~~OSEQUITY” )
{
printf( “For accurate results switch to ~~~EQUITY symbol
” );
}
}CheckSymbol();
////////////////////////////
// Main program
////////////////////////////
GenProfitTableHTML();LeeDanelloParticipantJulian Cohen wrote:Have you tried it on the ASX Maurice? I couldn’t get a good result on the ASX although I’m still waaaay behind you guys so I’m probably making some idiot mistake.I haven’t Julian. Just trying to get the interest going again so we can tweak it for the US market. I’d image it wouldn’t be as good because of the smaller size of the universe.
LeeDanelloParticipantTrent Rothall wrote:How do you get the MDD column on the VAMI table Maurice?I am not sure if my thoughts are correct maybe Nick could comment, but I like to see Ave trade P/L % closer to 1(or above) than 0, I just think the smaller the ave win the easier it is for the system to go out of sync with the market (enter DD) or lose it edge all together because the edge is only small to start off with.
In the ideal world it would be nice but as long as we’re on the right side of the expectancy curve then it’s OK
I say let’s improve it!I will post the code of the profit table later on
Taken from “Successful Stock Trading A Guide to Profitabilty p 18
What this tells me is that I should trade for the greater profit, but be
prepared for the bad times when they come along. As opposed to not
wanting any bad times, I just want to be profitable.
I could fill this whole eBook with similar examples. We could make our
systems more and more complicated to help improve those numbers and,
hopefully, profitability; however, the more you attempt to improve the
numbers by tweaking the entries and exits, the more you adapt your
approach to historical price movements. This is called data mining and it is
a very serious trap for new and experienced traders alike.LeeDanelloParticipantAn update on the Bollinger collaboration.
I modified a couple of the rules and the results from a single run back test are fairly good although I would like to reduce the draw down a little more.
These are a single backtest on the Russell 1000. Maybe someone would like to do a Monte Carlo and tweak it more? Otherwise I’m open to more suggestions.
I’m not sure Cond 4 adds much.Full code is below
Code:/*For the sake of getting started here is a swing trading strategy using BB.the rules are as follows:
No index Filter
Min average Volume is 500K
Close is above MA 100 days
BB (5,1.5)
Close below the lower band
BB width is greater than 5% (BBWidth = (BBTop – BBBot)/ BBBot *100;)
Buy on limit order if the price drops a bit under the low (0.5ATR(10))
Sell cross with MA 5days*/_SECTION_BEGIN( “Historical Database Testing” );
//====================================================================
//Historical Database Testing
//====================================================================ASXList = ParamList( “ASX Historical Watchlist:”, “1: Off|2: ASX 20|3: ASX 50|4: ASX 100|5: ASX 200|6: ASX 300|7: ASX All Ordinaries|8: ASX Small Ordinaries|9: ASX Emerging Companies|10: Excluding ASX 300|11: In XAO but Exc ASX 100|12: Exc XAO”, 0 );
HistDB = 1;//set to 1 to start
if( ASXList == “1: Off” ) HistDB = 1;
if( ASXList == “2: ASX 20” ) HistDB = IsIndexConstituent( “$XTL” );
if( ASXList == “3: ASX 50” ) HistDB = IsIndexConstituent( “$XFL” );
if( ASXList == “4: ASX 100” ) HistDB = IsIndexConstituent( “$XTO” );
if( ASXList == “5: ASX 200” ) HistDB = IsIndexConstituent( “$XJO” );
if( ASXList == “6: ASX 300” ) HistDB = IsIndexConstituent( “$XKO” );
if( ASXList == “7: ASX All Ordinaries” ) HistDB = IsIndexConstituent( “$XAO” );
if( ASXList == “8: ASX Small Ordinaries” ) HistDB = IsIndexConstituent( “$XKO” ) AND NOT IsIndexConstituent( “$XTO” );
if( ASXList == “9: ASX Emerging Companies” ) HistDB = IsIndexConstituent( “$XEC” );
if( ASXList == “10: Excluding ASX 300” ) HistDB = IsIndexConstituent( “$XKO” ) == 0;
if( ASXList == “11: In XAO but Exc ASX 100” ) HistDB = IsIndexConstituent( “$XAO” )AND NOT IsIndexConstituent( “$XTO” );
if( ASXList == “12: Exc XAO” ) HistDB = IsIndexConstituent( “$XAO” ) == 0;//———————————————————————————
USList = ParamList(“US Historical Watchlist:”,”1: Off|2: Russell 1000|3: Russell 2000|4: Russell 3000|5: NASDAQ 100|6: Dow Jones Industrial Average|7: S&P 500|8: S&P 100|9: S&P MidCap 400|10: S&P SmallCap 600|11: S&P 1500|12: Russell MicroCap|13: Russell MidCap”,0);
USHistDB = 1;//set to 1 to startif(USList == “1: Off”) USHistDB = 1;
if(USList == “2: Russell 1000”) USHistDB = IsIndexConstituent(“$RUI”);
if(USList == “3: Russell 2000”) USHistDB = IsIndexConstituent(“$RUT”);
if(USList == “4: Russell 3000”) USHistDB = IsIndexConstituent(“$RUA”);
if(USList == “5: NASDAQ 100”) USHistDB = IsIndexConstituent(“$NDX”);
if(USList == “6: Dow Jones Industrial Average”) USHistDB = IsIndexConstituent(“$DJI”);
if(USList == “7: S&P 500”) USHistDB = IsIndexConstituent(“$SPX”);
if(USList == “8: S&P 100”) USHistDB = IsIndexConstituent(“$OEX”);
if(USList == “9: S&P MidCap 400”) USHistDB = IsIndexConstituent(“$MID”);
if(USList == “10: S&P SmallCap 600”) USHistDB = IsIndexConstituent(“$SML”);
if(USList == “11: S&P 1500”) USHistDB = IsIndexConstituent(“$SP1500”);
if(USList == “12: Russell MicroCap”) USHistDB = IsIndexConstituent(“$RUMIC”);
if(USList == “13: Russell MidCap”) USHistDB = IsIndexConstituent(“$RMC”);//———————————————————————————
HDBFilter = HistDB AND USHistDB;
//====================================================================
_SECTION_END();_SECTION_BEGIN(“Optional Price Filter and TO Filter”);
//====================================================================
//Price and Volume Filters
//====================================================================
PriceTog = ParamToggle(“Price Filter”,”Off|On”,1);
PF = ParamField(“Price Field”,6);
MinSP = Param(“Minimum Share Price – $”,5,0.00,1000,0.01);
MaxSP = Param(“Maximum Share Price – $”,100,0.00,2000,0.01);
MinMaxSP = PF >= MinSP AND PF <= MaxSP; PriceFilt = IIf(PriceTog,MinMaxSP,1); //-------------------------------------------------------------------- VolTog = ParamToggle("Volume Filter","Off|On",1); //Turnover = PF*V; //MinTO = Param("Minimum Turnover - $",500000,0,10000000,1000); MinVol = Param("Minimum Volume",500000,0,10000000,1000); //TOMA = Param("Turnover MA",10,1,200,1); VolMA = Param("Volume MA",10,1,200,1); //AveTO = EMA(Turnover,TOMA); AveVol = EMA(Volume,VolMA); //TOFilter = AveTO > MinTO AND Turnover > MinTO;
VolFilter = AveVol > MinVol AND Volume > MinVol;
VolFilt = IIf(VolTog,VolFilter,1);
//——————————————————————–
OptFilt = PriceFilt AND VolFilt;
//====================================================================
_SECTION_END();_SECTION_BEGIN(“Index Filter”);
//====================================================================
//Index Filter
//====================================================================
IndexTog = ParamToggle(“Index Filter”,”On|Off”,1);
IndexCode = ParamStr(“Index Symbol”,”$SPX”);
Index = Foreign(IndexCode,”C”);
IndMA = Param(“Index Filter MA”,150,2,250,1);IndexFiltUp = Index > MA(Index,IndMA);
IndexUp = IIf(IndexTog,1,IndexFiltUp);
//====================================================================
_SECTION_END();//====================================================================
//Universe Filter
//====================================================================
List = Paramlist(“Universe Filter:”,”1:Off|2:Resources|3:Industrials”,0); //– this sets the drop down list
UniverseFilter = 1; //– set the filter to 1 to start
If (List == “1:Off”) UniverseFilter = 1;
If (List == “2:Resources”) UniverseFilter = InGics(“10”) OR InGics(“151040”);
If (List == “3:Industrials”) UniverseFilter = InGics(“10”)==0 OR InGics(“151040”)==0;
//====================================================================
_SECTION_END();//====================================================================
//Entry and Exit Rules
//====================================================================
MArange = Param(“MA Range”,200,1,1000,1);
Mult = Param(“Squeeze”,0.75,0.1,2,.05);
function ParamOptimize(pname,defaultval,minv,maxv,step)
{
return Optimize(pname,Param(pname,defaultval,minv,maxv,step),minv,maxv,step);
}
//——————————————————————–
//Limit Entry using the stretch
//——————————————————————–
ATRp = Param(“Limit Price: ATR period”,10,1,20,1);
ATRmulti = Param(“Limit Price: ATR Multi”,0.5,0,1.5,.1);
ATRVal = ATR(ATRp)*ATRmulti;
BuyLimP = L – ATRval; //stretch
TickLo = IIf(MarketID(0) == 10 OR MarketID(0) == 14 ,IIf(L<0.10,0.001,IIf(L<2.00,0.005,0.01)),0.01);
BuyLimVal = round(BuyLimP/TickLo);
BuyLim = BuyLimVal * TickLo; //stretch
//--------------------------------------------------------------------
//Keltner & BBands
//--------------------------------------------------------------------
Periods = Param("Bollinger Period",5,1,100,1);
Width = Param("Width", 1.5,0,3,0.1 );
UpperBand = BBandTop( C, Periods, Width );
LowerBand = BBandBot( C, Periods, Width );
CenterLine = MA( C, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );Keltner = (KTop - KBot);
Bollinger = (UpperBand - LowerBand);
Squeeze = (Bollinger/Keltner)*100;
BBWidth = ((UpperBand - LowerBand)/CenterLine)*100;
KWidth = ((KTop - KBot)/CenterLine)*100;
//--------------------------------------------------------------------
Cond1 = L < LowerBand; Cond2 = C >= MA(C,MArange);
Cond3 = OptFilt AND IndexUp AND UniverseFilter AND HDBFilter;
Cond4 = BBWidth < Mult*KWidth; OnLastTwoBarsOfDelistedSecurity = BarIndex() >= (LastValue(BarIndex()) -1) AND !IsNull(GetFnData(“DelistingDate”));
OnSecondLastBarOfDelistedSecurity = BarIndex() == (LastValue(BarIndex()) -1) AND !IsNull(GetFnData(“DelistingDate”));BuySetUp = Cond1 AND Cond2 AND Cond3 AND Cond4;
LE = Ref(BuySetUp,-1) AND L <= Ref(BuyLim,-1) AND NOT OnLastTwoBarsOfDelistedSecurity; LEPrice = Min(O,ref(BuyLim,-1)); LExPrice = O; SellSetUp = H > MA(C,Periods); //sell at middle band
LEx = Ref(SellSetUp,-1);
//——————————————————————–
//Stops
//——————————————————————–
Short = Cover = False;
//====================================================================
//Looping
//====================================================================
Buy = 0;
Sell = 0;
LPriceAtBuy = 0;
LBIT = 0;
//====================================================================
for( j = 1; j < BarCount; j++ ) { if( LPriceAtBuy == 0 AND LE[j] ) { Buy[j] = True; LPriceAtBuy = LEPrice[j]; BuyPrice[j] = LEPrice[j]; LBIT[j] = 1; if( LBIT[j] > 1 AND LEx[j] OR OnSecondLastBarOfDelistedSecurity[j] )
{
Sell[j] = True;
SellPrice[j] = LExPrice[j];
LPriceAtBuy = 0;
}
}
else
if( LPriceAtBuy > 0 )
{
LBIT[j] = LBIT[j – 1] + 1;
if( LBIT[j] > 1 AND LEx[j] OR OnSecondLastBarOfDelistedSecurity[j] )
{
Sell[j] = True;
SellPrice[j] = LExPrice[j];
LPriceAtBuy = 0;
}
}
}//====================================================================
LESetup = IIf(LBIT==0 OR Sell==1,BuySetUp,0); //Long Entry Set Up
LExSetup = IIf(LBIT>0 AND Sell==0,SellSetup,0); //Long Exit Set Up//——————————————————————–
Filter = Buy OR Sell OR LESetUp OR LExSetUp OR LBIT>0;
AddTextColumn(WriteIf(LESetup,”Buy Setup”,””),”Entry Signal”,1.2,colorDefault,IIf(LESetup,colorBrightGreen,colorDefault),130);
AddTextColumn(WriteIf(LExSetup,”Exit”,””),”Exit Signal”,1.2,colorDefault,IIf(LExSetup,colorRed,colorDefault),100);
AddTextColumn(WriteIf(Buy,”Buy”,””),”Today’s Entries”,1.2,colorDefault,IIf(Buy,colorGreen,colorDefault),130);
AddTextColumn(WriteIf(Sell,”Sell”,””),”Today’s Exits”,1.2,colorDefault,IIf(Sell,colorRed,colorDefault),130);
AddColumn(LBIT,”LBIT”,1.0);
SetSortColumns(-3,-4,-5,-6,1);/*Filter = 1;
AddColumn(BuySetUp,”Buy Setup”,1);
AddColumn(Buy,”Buy”,1);
AddColumn(SellSetUp, “Sell Setup”,1);
AddColumn(Sell,”Sell”,1);
*/
//====================================================================
//Interpretation Window
//====================================================================
“3 Lower Closes and below lower band: “+WriteIf(Cond1,”Yes”,”No”);
“Above long term MA: “+WriteIf(Cond2,”Yes”,”No”);
“Index Filer On: “+WriteIf(IndexTog,”No”,”Yes”);
“”;
“Bars In Trade: “+NumToStr(LBIT,1);
“Close above mid band: “+WriteIf(SellSetUp,”Yes”,”No”);
//====================================================================
_SECTION_BEGIN(“Chart Plotting”);
//====================================================================
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
ChartType = ParamList(“Chart Type”,”OHLC Bar|Candle|Line”,0);
SetChartBkColor(ParamColor(“Background Colour”,colorWhite));UpColour = ParamColor(“Bar/Candle Up Colour”,colorGreen);
DownColour = ParamColor(“Bar/Candle Down Colour”,colorRed);Colour1 = IIf(C > Ref(C,-1),UpColour,DownColour);
Colour2 = IIf(C > O,UpColour,DownColour);
Colour3 = ParamColor(“Line Chart Colour”,colorRed);
TextColour = ParamColor(“Text Colour”,colorBlack);if(ChartType == “OHLC Bar”) ChartOption = styleBar;
if(ChartType == “Candle”) ChartOption = styleCandle;
if(ChartType == “Line”) ChartOption = styleLine;if(ChartType == “OHLC Bar”) ColourOption = Colour1;
if(ChartType == “Candle”) ColourOption = Colour2;
if(ChartType == “Line”) ColourOption = Colour3;
//——————————————————————–
Plot(Close,”Close”,ColourOption,styleNoTitle|ChartOption|ParamStyle(“Chart Style”));
GraphXSpace = 10;PlotShapes(shapehollowUpArrow*LESetup,colorGreen,0,L,-40); //plots an arrow for a setup bar
PlotShapes(shapehollowdownArrow*LExSetup,colorRed,0,H,-40); //plots an arrow for an exit bar
PlotShapes(shapeHollowSmallSquare*Buy,TextColour,0,BuyPrice,0); //plots a small hollow square right at the buy price
PlotShapes(shapeHollowSmallSquare*Sell,TextColour,0,SellPrice,0); //plots a small hollow square right at the sell price
//——————————————————————–
FirstVisibleBar = Status(“FirstVisibleBar”);
LastVisibleBar = Status(“LastVisibleBar”);for( b = Firstvisiblebar; b <= Lastvisiblebar AND b < BarCount; b++) { if(Buy[b]) PlotText("n Buyn "+NumToStr(BuyPrice[b],1.3),b,BuyPrice[b]*0.9985,TextColour); else if(Sell[b]) PlotText("n Selln "+NumToStr(SellPrice[b],1.3),b,SellPrice[b]*0.9985, TextColour); } //==================================================================== _SECTION_END(); _SECTION_BEGIN("Backtesting"); //===================================================================== //options in automatic analysis settings //===================================================================== SetTradeDelays(0,0,0,0); SetOption("UsePrevBarEquityForPosSizing",True); Capital = Param("Initial Equity $",100000,1000,1000000,100); SetOption("InitialEquity",Capital); MaxPos = Param("Maximum Open Positions",20,1,100,1); SetOption("MaxOpenPositions",MaxPos); SetOption("AllowSameBarExit",False); SetOption("AllowPositionShrinking", False ); SetOption("InterestRate",0); SetOption("Minshares",1); //SetOption("CommissionMode",2); //Fixed Dollar Amount //SetOption("CommissionAmount",6); //Use IB commision rates SetOption("AccountMargin",100); PositionScore = mtRandom(); //--------------------------------------------------------------------- ""; "Position Sizing Method:"; PosSizeMethod = ParamList("Position Sizing Method:","Fixed Fractional Risk %|Fixed $ Risk Amount|Fixed $ Total Position Size|Fixed % of Portfolio Equity",3); //Risk Calculation FDAmount = Param("Fixed $ Total Position Size",5000,100,100000,100); //Fixed % of Portfolio Equity FPAmount = Param("Fixed % of Portfolio Equity",5,1,100,1); if(PosSizeMethod == "Fixed Fractional Risk %") SetPositionSize(Risk1,spsPercentOfEquity); if(PosSizeMethod == "Fixed $ Risk Amount") SetPositionSize(Risk2,spsShares); if(PosSizeMethod == "Fixed $ Total Position Size") SetPositionSize(FDAmount,spsValue); if(PosSizeMethod == "Fixed % of Portfolio Equity") SetPositionSize(FPAmount,spsPercentOfEquity); //==================================================================== _SECTION_END();
LeeDanelloParticipantTASC Traders Tips.
I’m not sure if this is by design or default but you can access all the strategies by copying and pasting the link and changing the year and month.
Most strategies work but they all have horrendous drawdowns
http://traders.com/Documentation/FEEDbk_docs/2016/06/TradersTips.html#item4.
Has worked for a few years.
I use it as an Amibroker learning tool.
-
AuthorPosts