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

[amibroker] Re: Setup for Forex backtesting



PureBytes Links

Trading Reference Links

I replaced RSW with WtdMAM for PositionScore and getting slightly 
better results:

function MOM(price, momper)
{
// Standard momentum

return (100 * ((price / Ref(price, -momper)) - 1));
}

function MAM(price, momper)
{
// Most Anchored Momentum -

// An outgrowth of a MA filter is that the MA is delayed by the 
period/2.
// To get the coincident average of a price N ticks ago, use a period 
OR
// N*2 for the MA. This is used to "anchor" the demonimator of the
// momentum calculation.

smaper = 2 * momper + 1;
return (100 * ((price / MA(price, smaper)) - 1));
}

mperiod = 16;

Plot(MOM(Close, mperiod), "MOM", colorYellow, styleLine);

Plot(MAM(Close, mperiod), "MAM", colorGreen, styleLine);

Plot(0, "", colorWhite, styleLine);
 
WtdMAM = 0.4*MAM(C,63) + 0.2*MAM(C,126) + 0.2*MAM(C,189) +
0.2*MAM(C,252);

PositionScore=WtdMAM;//

rgds, Pal

--- In amibroker@xxxxxxxxxxxxxxx, "Pal Anand" <palsanand@xxxx> wrote:
> I have it for Mini-Forex as:
> 
> Initial equity = 1000
> Positions = Long and Short
> Periodicity = Daily
> Allow position size shrinking
> Reverse entry signal forces exit
> Allow single bar trade (same bar trade)
> MinShares = 130
> Round Lot Size = 10 (Assuming 1 contract = 10 Lots)
> Tick Size = 1
> Commissions & rates = 0  //Assuming no slippages, would set it to 
0.5 
> for trades > $1,000,000.00
> Annual interest rate = 0
> Margin requirement = 2
> 
> LB1=5;LB2=16;
> //MaxOpenPos= LB = Optimize("MaxOpenPos",5,LB1,LB2,1); //Optimized 
> using UPI
> MaxOpenPos= LB = Param("MaxOpenPos",5,LB1,LB2,1);
> SetOption("MaxOpenPositions", MaxOpenPos );
> 
> MS1=130;MS2=390;
> //MinShares = Optimize("MinShares",130,MS1,MS2,100);
> MinShares = Param("MinShares",130,MS1,MS2,100);
> SetOption("MinShares", MinShares);
> 
> PositionSize=-100/MaxOpenPos=-100/5=-20 Lots(-2 Contracts)
> =MaxRisk*Equity/(-MDD/2);
> 
> /* Assuming MDD of 30% and verified by MCS.  In reality, I limit my 
> MaxRisk to 10% per trade, eventhough Optimalf% based on Win/Loss 
> ratio of 96/4 comes out with a MaxRisk (Optimalf%) of 92%.  
> Historical Kelly Value for MaxRisk = 0.45 */
> 
> MaxRisk/trade=-2*(-300/2)/1000=0.3 = 30%
> 
> //TR1 = Optimize("TotalReturn1",0.25,0.10,0.50,0.05);
> TR1 = Param("TotalReturn1",0.25,0.10,0.50,0.05);
> //TR2 = Optimize("TotalReturn2",0.45,0.10,0.50,0.05);
> TR2 = Param("TotalReturn2",0.45,0.10,0.50,0.05);
> //TR3 = Optimize("TotalReturn3",0.45,0.10,0.50,0.05);
> TR3 = Param("TotalReturn3",0.45,0.10,0.50,0.05);
> //TR4 = Optimize("TotalReturn4",0.45,0.10,0.50,0.05);
> TR4 = Param("TotalReturn4",0.45,0.10,0.50,0.05);
> 
> tr13 = TR1 * (C - Ref(C, -63)) / Ref(C, -63) * 100;
> tr26 = TR2 * (C - Ref(C, -126)) / Ref(C, -126) * 100;
> tr37 = TR3 * (C - Ref(C, -189)) / Ref(C, -189) * 100;
> tr52 = TR4 * (C - Ref(C, -252)) / Ref(C, -252) * 100;
> 
> RSW = tr13 + tr26 + tr37 + tr52;  //Plan to experiment with Most 
> Anchored Momentum (MAM) later
> 
> PositionScore = RSW;
> 
> Would be curious to know what you come up with.  Feedback 
appreciated 
> from all.
> 
> rgds, Pal
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "pip_hunter_2003" 
> <pip_hunter_2003@xxxx> wrote:
> > How to set up the AmiBroker 4.50 std for EURUSD Forex backtesting?
> > 
> > I want to buy and sell only 1 slot / trade.


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 Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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/