Click here to Login

Trading Software Trading objects Features How-to Blog Search


                                                   Dynamic Position

  0

0
sugiarto tjokrokusumo
2010-09-30 12:44:29


Hi Guru,

i have some question regarding quantshare programming. been played with it for a few days, do you have any setting for dynamic positioning.

for example let say if the RSI(14) > 50 i want to set my buying position of 50% of the money but if the RSI(14) < 30 i want to set my buying position of 100% of the money i have

any idea how to do this?

thank you

Sugiarto



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.



sugiarto tjokrokusumo
2010-09-30 14:01:44

  0

thank you for the fast reply. will try to incorporate the code :)

thanks a lot

sugi



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
NSE - Security-wise Delivery Position
McGinley Dynamic Indicator
Traders Dynamic Index - TDI Indicator
VIDYA - Variable Index Dynamic Average
Forex Long to Short Position Ratios

How-to Lessons
How to create a volatility-based Stop - Dynamic stop based on the...
How to perform a basic quantitative analysis using the S&P 500
How to create a trading system
How to display the number of notes per stock
How to quickly add several positions to your portfolio

Related Forum Threads
Dynamic Checklist to Compare Open to yesterday's Close
Dynamic Watchlist update for each time step during a simulation?
Set the buy or sell price
One result by the screener
How do I use variables in Money Management Scripts?

Blog Posts
5 position sizing techniques you can use in your trading system
How to Create Custom Metrics for Your Trading Positions
Day Trading: A trading system that combines intraday and EOD data
How to create buy and sell trading rules based on News Data
Watch your support and resistance lines









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items