Click here to Login





                                                   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
Dynamic Position Sizing
Exit Position based on Profitability
Stock Industry Position
Capital Allocation based on Moving Average position on Instrument
NSE - Security-wise Delivery Position

How-to Lessons
How to create a volatility-based Stop - Dynamic stop based on the...
How to create a real-time watchlist
How to create a watchlist
How to quickly add several positions to your portfolio
How to add custom position-based metrics to your trading system

Related Forum Threads
Enhanced Dynamic Position Sizing money mgmt - some issue
NaN error in Dynamic Position Sizing MM object
Dynamic Position Sizing
dynamic position sizing based on stocks selected by the buy rules
Simulation/Back testing - Default position sizing method

Blog Posts
Dynamic Position Sizing in your Trading System
5 position sizing techniques you can use in your trading system
How to Create Custom Metrics for Your Trading Positions
Troubleshooting a Trading System
QuantShare Trading Software: New Features in the 3.1.2 Version









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 © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.