Click here to Login





                                                   ATR stop and MM

  0

0
Bentley
2015-11-10 07:09:23


Hi there,
Does QS have what TradeStation name as ATR stop.

For e.g. - ATR Big Profit Stop (there's also other and combine together seem like a lethal ways for exit)
The average true range is calculated and multiplied by BigProfitATRs (Input) in order to determine the %u201CBig
Profit%u201D level. On the first bar of a position, the reserved word BarsSinceEntry will return zero. When this occurs,
the variable PosHL is set to the Close of the current bar. ---
ATRVal = AvgTrueRange(ATRLength) * BigProfitATRs;
If BarsSinceEntry = 0 Then
PosHL = Close;

As long as the market is in a Long position, there is a constant testing of PosHL compared to the current Close.
If the current Close is greater than PosHL, then PosHL is reset to the value of the new Close, maintaining the
highest Close value of the position in PosHL. The Long exit order is generated once the position has reached
ATRVal points above EntryPrice. If the price activity has reached this level, a Long exit order at the lowest Low
of the last ExitBarLen (Input) bars. ---
If MarketPosition = 1 Then Begin
If Close > PosHL Then
PosHL = Close;
If PosHL > EntryPrice + ATRVal Then
ExitLong Next Bar at Lowest(Low, ExitBarLen) Stop;
End;

Also, how to code
Buy Next Bar at High + 1 point ;
I can use the wizard to do it but was just wondering how to actually code it..
I did something like Buyprice(ref (high, -1)+1),10);

And since I'm asking, I saw the Simulation 1 trading system have both the AND and && syntax in one statement.
A bit confuse which one to use... +_+!!!


Thanks







QuantShare
2015-11-11 03:04:41



Hi,

You can use the average true range (ATR) as a trailing stop for example by adding this line:
SetSimStop(_StopTrailing, _Point, 2*atr(14), 0);

If you are looking for some customized things then you should implement a money management script using C# language.

For the buy price, yes you should use the "BuyPrice" function. But it works only when using a stop or limit order.

buy = roc(10) > 20;
SetSimTiming(_Buy, _Limit, 0);
Buyprice(ref (high, -1)+1),10);

The above formula means that when a stock 10-bar rate of return is above 20, buy it using a limit order and a limit price of "tomorrow high + 1".

ref (high, -1) references tomorrow's high
ref (high, 1) references yesterday's high


Finally, you can use either AND or &&. They are the same.



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
ATR - Average True Range Drawing Tool
Dividend per share, Dividend Yield and Historical Dividend Growth
Entry Trailing Stop
Disable or Enable your Stop Rules
Bulls and Bears Strategy

How-to Lessons
How to create a volatility-based Stop - Dynamic stop based on the...
How to optimize the stop limit of a trading system
How to create and trade a Neural Network model
Difference between the watchlist and the screener tools
How to create trading rules based on Put and Call volume data

Related Forum Threads
ATR stop in chart
How to implement Sell Condition "N-Bar Stop AND Rank>50"?
Simulator - Activate stop immediately
Setting stop loss for each trade
Profit loss protection trailing stop line on chart .

Blog Posts
Backtesting a Strategy Based on Bond and Stock Index ETFs
Limit and Market orders
Adding Trading Indicators and Formulas to a Chart
How to get buy and sell orders for a portfolio based on a trading...
Day Trading: A trading system that combines intraday and EOD data









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.