I want to back-testing a simple trading system, the formula is as 
follows: 

Cond = Cross( MA (Close, 20), MA(Close, 50) );
Cond1 = Cross( MA (Close, 50), MA(Close, 20) );
MA20 = MA( Close, 20 );
MA50 = MA( Close, 50 );
Crosses = Cross( MA20, MA50 ) OR Cross( MA50, MA20 ) ;
Buy = Cond;
Sell = Cond1;

I'm going to add buy(or short) and sell(or cover), as well as stop-
loss conditions. Such as: when to buy or short a stock, if it has a 
profit of 3%, should sell(or cover) to close this position. If the 
loss occurred, when the loss is 2% to sell(or cover) to stop loss. In 
addition, total capital is $100,000, per transaction for a 10% of the 
capital, while a maximum of 10 positions, not considering 
commissions. I don't know how to write this formula, any help would 
be appreciated!
   
Frank

Reply via email to