Click here to Login

Trading Software Trading objects Features How-to Blog Search


                                                   How do you retrieve the entry and exit price for a position?

  2

0
alienator
2010-06-15 09:23:43


How do you retrieve the entry and exit price for a position?


QuantShare
2010-06-15 12:12:49

  0

Are you referring to the money management tool?


alienator
2010-06-15 14:50:39

  0

No, I want to be able to use a rule to manually stop a position and be sure it stops at a certain price.

Sell using limit order at the price of: iff( rule , limit price 1, limit price 2)

the rule is: (low < entry - (entry*0.05)).

How do I retrive the price at which the position was entered?

Thanks



QuantShare
2010-06-16 14:56:09

  0

Best Answer
In order to perform this, you should use the money management tool:
In the "OnClosePosition" event, add the following code:

MMExitPosition pos = Functions.GetPositionDetails();
TimeSeries low = Data.GetPriceSeries(pos.Symbol, "low");
if(low[0] < pos.EntryPrice - (pos.EntryPrice * 0.05))
{
double limitPrice1 = low[0]; // Update this field
int orderValid = 10; // 10 days
_TradingOrder order = Orders.LimitOrder(limitPrice1, 0, orderValid);
Functions.UpdateOrder(order);
}
else
{
double limitPrice2 = low[0]; // Update this field
int orderValid = 10; // 10 days
_TradingOrder order = Orders.LimitOrder(limitPrice2, 0, orderValid);
Functions.UpdateOrder(order);
}



alienator
2010-06-17 06:51:30

  0

Thank you so much!!


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
Entry Price and Exit Price in Trading System Report
Market Index for the Gold and Silver Industry
High to low stock pattern for the close price
Tweet Sentiment Index for the Forex and Stock Market
Industry and Sector Information for the US Stock Market

How-to Lessons
How to quickly download the most recent EOD data for your stocks
How to change volume bar colors when the price closes down
How to download EOD quotes for active and valid stocks only
How to get stocks for a particular index using the global script
How to scale and move the chart Y-axis

Related Forum Threads
How do I find the close price for an entry matching a custom DB
How to browse and search the blog?
How do I refer to the close price of another symbol in a formula?
Set the buy or sell price
Basic features and some issues with the background

Blog Posts
How to predict and trade the stock market using pivot points
How to get buy and sell orders for a portfolio based on a trading...
6 ways to download free intraday and tick data for the U.S. stock...
Step by step on how to get free realtime/delayed data for stocks,...
How to filter quotes data from high and low price spikes









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