Click here to Login





                                                   Place a profit stop through Money management strategy

  0

0
Obuli Govindaraju
2011-10-24 22:05:03


I am facing a challenge where I need to place a profit stop limit order.

Here is the logic.

At the close of the day if a 90-10 High continuation (day closes at the top 10% of days range) scenario exists
then place a market order to buy at open (for tomorrow)
Once the order is filled place a profit stop order limit at 1.272 extension of Signal Dayrange (that is yesterdays range)

I can get the buy part working either through the strategy using wizard or Money management scripts,
but I not able to write a strategy nor MM script for the sell part?

Help!!!!



QuantShare
2011-10-25 05:43:25

  0

Best Answer
You can for example use the following MM script (OnEndPeriod):

MMPosition[] positions = Portfolio.GetOpenPositions();
for(int i=0;i < positions.Length;i++)
{
MMPosition pos = positions[i];
TimeSeries close = Data.GetPriceSeries(pos.Symbol, "close");
TimeSeries ts = Data.ParseFormula("a = high * 1.272;").GetTimeSeries(pos.Symbol, "a");
if(close[0] > ts[(int)pos.BarsSinceEntry])
{
pos.ClosePosition();
}
}



Obuli Govindaraju
2011-10-25 08:15:17

  0

Thank you.

I see that you are using OnEndPeriod.

I am using onEndPeriod to validate the buy condition and issue a market open order for next day. Should I include your script on the same MM script OnEndPeriod as buy or a separate MM Script?

Also your sell script is also based on the bars close. My sell limit price can reach sometime during the day even before the bar close.

So here is the logic flow as I see

onEndPeriod

Evaluate for buy condition and if true place a market open order

<Your sell script here> - Now this will not get executed since there are no new positions

next bar onEndPeriod (daily chart)

Evaluate for buy condition and if true place a market open order

<Your sell script here> - Now this will be true and gets executed

The problem I see here is that the close script gets executed only at the end of the day but then the sell price can happen any time during the day after I buy from the open.

So I need an event that when a order is filled my profit stop should kick in.

Let me know if my understanding is incorrect.

Thanks for the great work.




QuantShare
2011-10-26 05:46:27

  0

1- You can use it on the same script

2- You can also do the following:

- Remove the previously added MM Script
- Set "Activate stop immediately" in "Simulator -> Settings -> Capital"
- Set the following line in QuantShare formula:

SetSimStop(_StopProfit, _Point, (high * 1.272) - close, 0);




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
Return per Bar Stop - Money Management Strategy
Correlation Filter Money Management Strategy
Investing in stocks using the Kelly criterion money management st...
Long strategy created with the money management tool
Averaging Down Money Management Strategy

How-to Lessons
How to calculate the average of a time series using the money man...
How to debug a trading system using the money management tool
How to create a volatility-based Stop - Dynamic stop based on the...
How to optimize the stop limit of a trading system
How to generate buy/sell signals from a trading system

Related Forum Threads
example of advanced money management tool Stop Order
Money Management script and exit options in the wizard
Money management script help - Targeted net profit per day
Advanced Money Management
Reuse optimization parameters from Strategy script in Money Mgmt

Blog Posts
Create a trading strategy using the money management tool - Part ...
Create a trading strategy using the money management tool - Part ...
Money Management: Scale-in Trading Strategy
Basic trading system implemented using the money management tool
Several money management strategies in a trading system









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.