|
QuantShare
2010-09-30 13:52:19
1
|
|
Best Answer
In order to do this, you must create a new money management script in your trading system, then type the following script in the "OnNewPosition" event:
TradingSystemSettings.IsAutoAjustCashNewPositions = false;
string symbol = NewPosition.Symbol;
TimeSeries ts = Data.ParseFormula("a = rsi(14);").GetTimeSeries(symbol, "a");
if(ts[0] > 50)
{
// Buy only 50%
double nbShares = NewPosition.NbShares;
Functions.UpdateNumberOfShares((int)(nbShares / 2));
}
The script simply checks the value of RSI and divides the number of shares by two (50%) if the RSI value is higher than 50.
The script can be applied to a strategy with one or several symbols.
|
|