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

[EquisMetaStock Group] backtest in AB - result in Metastock - automated trading via Hyperorder



PureBytes Links

Trading Reference Links

Dear Metastock forum, 

I use AB for backtesting my trading ideas. Now I would like
to start using my results/formula from Amibroker to implement
them in Metastock to finally auto execute them via Hyperorder 
to my broker FXCM.

I would politely ask for help to translate this simple code
in Metastock code, so I can run it as my first trading system 
in Metastock. I surely will post infos back, when I successfully
got the system technically to run, so everybody can participate. 

The simple idea is: 

****************************************************************
buy when T3fast crosses T3slow
sell when T3slow crosses T3fast OR price crosses TrailingStop
short when T3slow crosses T3fast
cover when T3fast crosses T3slow OR price crosses TrailingStop

parameter for T3fast = 8 
parameter for T3slow = 21
Trailingstop nPpip "distance" is "15" -> = "0.0015" on EURUSD 
Ordersizeposition should be fixed to 1 lot (USD 100.000)

****************************************************************

Depending on paramter values and time frame this system
as simple it is, can be VERY (!) effective - believe me. 

Thank you very much for any help in advance.

Kind regards
Livetraderman

Code in Amibroker looks like:

****************************************************************

{TrailingStop Level}{ in AB the explicit definition 
of Trailingstop is NOT necessary, because ApplyStop function 
already includes the TrailingStop feature - so I posted the
code as an information, how the plotted TrailingStop in 
AB chart is calculated}

Code starts here:  

PrevC = C[ i - 1 ]; // previous bar value of close 
CurTrStopLevel = 
IIf( CurC == PREV, PREV, 
IIf( ( (PrevC < PREV) AND (CurC < PREV) ), 
Min( PREV, CurC * ( 1 + nPips) ), 
IIf( ( PrevC > PREV) AND ( CurC > PREV ), 
Max( PREV, CurC * (1 - nPips ) ), 
IIf( CurC > PREV, CurC * ( 1 - nPips), CurC * ( 1 + nPips) ) ) ) ); 
TrStopLevel[ i ] = CurTrStopLevel; // store result 
PREV = CurTrStopLevel; // save previous value for next iteration 
} 

{T3 parameter}
T3fast = 8;
T3slow = 21;

{T3 function}
function T3(price,periods)
{
s = 0.84;
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return Ti3;
}

Buy  = Cross(T3(C,T3fast),T3(C,T3slow));
Sell = Cross(T3(C,T3slow),T3(C,T3fast));
Short = Cross(T3(C,T3slow),T3(C,T3fast));
Cover = Cross(T3(C,T3fast),T3(C,T3slow));

ApplyStop(stopTypeTrailing, stopModePoint, 0.0015, 1, False, 1 ); 

PositionSize = 100000;

Code ends here:  
****************************************************************





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/