Click here to Login





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

  3

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
High to low stock pattern for the close price
Market Index for the Gold and Silver Industry
Staggered Entry and Exit Strategy
Tweet Sentiment Index for the Forex and 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 do you check if the price data is up to date?
Adjust the Entry and exit prices of trades in AMM script
MM Staggered Entry and Exit
How to browse and search the blog?

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...
How to Scan for Parallel Resistance and Support Lines
Step by step on how to get free realtime/delayed data for stocks,...









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 2021 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.